mirror of
https://github.com/mattiasgustavsson/libs.git
synced 2026-11-30 16:48:22 +01:00
Fix issue #46 xorshift rng returning wrong value for range
This commit is contained in:
@@ -508,7 +508,7 @@ int rnd_xorshift_range( rnd_xorshift_t* xorshift, int min, int max )
|
||||
{
|
||||
int const range = ( max - min ) + 1;
|
||||
if( range <= 0 ) return min;
|
||||
int const value = (int) ( rnd_xorshift_next( xorshift ) * range );
|
||||
int const value = (int) ( rnd_xorshift_nextf( xorshift ) * range );
|
||||
return min + value;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user