blob: 94a0ad59d347ce309bdb11fd191e9a1a72256da1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
#include "booksim.hpp"
#include "random_utils.hpp"
void RandomSeed( long seed )
{
ran_start( seed );
ranf_start( seed );
}
int RandomInt( int max )
// Returns a random integer in the range [0,max]
{
return( ran_next( ) % (max+1) );
}
unsigned long RandomIntLong( )
{
return ran_next( );
}
float RandomFloat( float max )
// Returns a random floating-point value in the rage [0,max]
{
return( ranf_next( ) * max );
}
|