2 Copyright © 1995-2012, The AROS Development Team. All rights reserved.
5 ANSI C functions rand() and srand().
8 #include "__arosc_privdata.h"
10 #include <aros/symbolsets.h>
12 /*****************************************************************************
23 A random number generator.
29 A pseudo-random integer between 0 and RAND_MAX.
42 ******************************************************************************/
44 struct aroscbase
*aroscbase
= __GM_GetBase();
46 aroscbase
->acb_srand_seed
= aroscbase
->acb_srand_seed
* 1103515245 + 12345;
48 return aroscbase
->acb_srand_seed
% RAND_MAX
;
52 /*****************************************************************************
63 Set the starting value for the random number generator rand()
64 If a seed value is set to a value the same stream of pseudo-random
65 numbers will be generated by rand() for the same seed value.
68 seed - New start value
74 One seed value per arosc.library is kept which normally corresponds
86 ******************************************************************************/
88 struct aroscbase
*aroscbase
= __GM_GetBase();
90 aroscbase
->acb_srand_seed
= seed
;
93 static int __rand_seedinit(struct aroscbase
*aroscbase
)
95 aroscbase
->acb_srand_seed
= 1;
100 ADD2OPENLIB(__rand_seedinit
, 0);