Xyris  0.5
rand.hpp File Reference
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define MAX_RAND   32767
 

Functions

int rand (void)
 
void srand (unsigned int seed)
 

Macro Definition Documentation

◆ MAX_RAND

#define MAX_RAND   32767

Definition at line 18 of file rand.hpp.

Function Documentation

◆ rand()

int rand ( void  )

Return a random value.

Returns
int Value from random number generator

Definition at line 22 of file rand.cpp.

23 {
24  _seedrand = _seedrand * 214013L + 2531011L;
25  return (unsigned int)(_seedrand >> 16) & MAX_RAND;
26 }

◆ srand()

void srand ( unsigned int  seed)

Set a seed to rand.

Parameters
seedRandom number generator seed

Definition at line 28 of file rand.cpp.

29 {
30  _seedrand = seed;
31 }
_seedrand
unsigned long _seedrand
Definition: rand.cpp:20
MAX_RAND
#define MAX_RAND
Definition: rand.hpp:18