From 1b2d6b4f2c3b2cf4ef5f4997ca7c159291934a79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Thu, 6 Apr 2006 07:06:04 +0000 Subject: [PATCH] initstate() and setstate() were disabled for some reason - they no longer are. This fixes bug #289. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17025 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/libroot/posix/stdlib/random.c | 26 +++++++----------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/src/system/libroot/posix/stdlib/random.c b/src/system/libroot/posix/stdlib/random.c index 60c7339aa9..8dc6bfd8aa 100644 --- a/src/system/libroot/posix/stdlib/random.c +++ b/src/system/libroot/posix/stdlib/random.c @@ -34,20 +34,11 @@ * */ -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)random.c 8.2 (Berkeley) 5/19/95"; -#endif /* LIBC_SCCS and not lint */ - -//#include /* for srandomdev() */ -//#include /* for srandomdev() */ #include #include -//#include /* for srandomdev() */ -/* - * random.c: - * - * An improved random number generation package. In addition to the standard + +/* An improved random number generation package. In addition to the standard * rand()/srand() like interface, this package also has a special state info * interface. The initstate() routine is called with a seed, an array of * bytes, and a count of how many bytes are being passed in; this array is @@ -141,8 +132,8 @@ static char sccsid[] = "@(#)random.c 8.2 (Berkeley) 5/19/95"; */ #define MAX_TYPES 5 /* max number of types above */ -//static long degrees[MAX_TYPES] = { DEG_0, DEG_1, DEG_2, DEG_3, DEG_4 }; -//static long seps [MAX_TYPES] = { SEP_0, SEP_1, SEP_2, SEP_3, SEP_4 }; +static long degrees[MAX_TYPES] = { DEG_0, DEG_1, DEG_2, DEG_3, DEG_4 }; +static long seps [MAX_TYPES] = { SEP_0, SEP_1, SEP_2, SEP_3, SEP_4 }; /* * Initially, everything is set up as if from: @@ -287,7 +278,6 @@ srandom(unsigned int x) * a fixed seed. */ #if 0 -/* not yet supported by NewOS */ void srandomdev() { @@ -321,6 +311,7 @@ srandomdev() rptr = &state[0]; } } +#endif /* * initstate: @@ -346,10 +337,7 @@ srandomdev() * complain about mis-alignment, but you should disregard these messages. */ char * -initstate(seed, arg_state, n) - unsigned long seed; /* seed for R.N.G. */ - char *arg_state; /* pointer to state array */ - long n; /* # bytes of state info */ +initstate(unsigned int seed, char *arg_state, size_t n) { register char *ostate = (char *)(&state[-1]); register long *long_arg_state = (long *) arg_state; @@ -448,7 +436,7 @@ setstate(arg_state) end_ptr = &state[rand_deg]; /* set end_ptr too */ return(ostate); } -#endif + /* * random: