compiler/clib: Rename IoErr2errno() to __arosc_ioerr2errno(); function is now defined...
[AROS.git] / compiler / clib / rand.c
blob137c34038676b5ef1738435e4fdf699869ef7ab3
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 ANSI C functions rand() and srand().
6 */
8 static unsigned int a = 1;
10 /*****************************************************************************
12 NAME */
13 #include <stdlib.h>
15 int rand (
17 /* SYNOPSIS */
18 void)
20 /* FUNCTION
21 A random number generator.
23 INPUTS
24 None.
26 RESULT
27 A pseudo-random integer between 0 and RAND_MAX.
29 NOTES
30 This function must not be used in a shared library or
31 in a threaded application.
33 EXAMPLE
35 BUGS
37 SEE ALSO
39 INTERNALS
41 ******************************************************************************/
43 return (a = a * 1103515245 + 12345) % RAND_MAX;
44 } /* rand */
47 #define srand srand
48 /*****************************************************************************
50 NAME */
51 #include <stdlib.h>
53 void srand (
55 /* SYNOPSIS */
56 unsigned int seed)
58 /* FUNCTION
59 Set the starting value for the random number generator rand()
61 INPUTS
62 seed - New start value
64 RESULT
65 None.
67 NOTES
68 This function must not be used in a shared library or
69 in a threaded application.
71 EXAMPLE
73 BUGS
75 SEE ALSO
77 INTERNALS
79 ******************************************************************************/
81 a = seed;
82 } /* srand */