fix RandomGen off by 1. Was retruning.[0,max), not [0,max]. (Caused random courseEntries to never pick the last song in the list)
This commit is contained in:
@@ -48,7 +48,10 @@ RandomGen::RandomGen( unsigned long seed_ )
|
||||
|
||||
int RandomGen::operator() ( int maximum )
|
||||
{
|
||||
return int(RandomFloat( seed ) * maximum);
|
||||
float f = RandomFloat(seed) * (maximum+1);
|
||||
int ans = int(f);
|
||||
CLAMP( ans, 0, maximum );
|
||||
return ans;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user