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
This commit is contained in:
@@ -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 <sys/time.h> /* for srandomdev() */
|
|
||||||
//#include <fcntl.h> /* for srandomdev() */
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
//#include <unistd.h> /* 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
|
* rand()/srand() like interface, this package also has a special state info
|
||||||
* interface. The initstate() routine is called with a seed, an array of
|
* 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
|
* 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 */
|
#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 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 seps [MAX_TYPES] = { SEP_0, SEP_1, SEP_2, SEP_3, SEP_4 };
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initially, everything is set up as if from:
|
* Initially, everything is set up as if from:
|
||||||
@@ -287,7 +278,6 @@ srandom(unsigned int x)
|
|||||||
* a fixed seed.
|
* a fixed seed.
|
||||||
*/
|
*/
|
||||||
#if 0
|
#if 0
|
||||||
/* not yet supported by NewOS */
|
|
||||||
void
|
void
|
||||||
srandomdev()
|
srandomdev()
|
||||||
{
|
{
|
||||||
@@ -321,6 +311,7 @@ srandomdev()
|
|||||||
rptr = &state[0];
|
rptr = &state[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* initstate:
|
* initstate:
|
||||||
@@ -346,10 +337,7 @@ srandomdev()
|
|||||||
* complain about mis-alignment, but you should disregard these messages.
|
* complain about mis-alignment, but you should disregard these messages.
|
||||||
*/
|
*/
|
||||||
char *
|
char *
|
||||||
initstate(seed, arg_state, n)
|
initstate(unsigned int seed, char *arg_state, size_t n)
|
||||||
unsigned long seed; /* seed for R.N.G. */
|
|
||||||
char *arg_state; /* pointer to state array */
|
|
||||||
long n; /* # bytes of state info */
|
|
||||||
{
|
{
|
||||||
register char *ostate = (char *)(&state[-1]);
|
register char *ostate = (char *)(&state[-1]);
|
||||||
register long *long_arg_state = (long *) arg_state;
|
register long *long_arg_state = (long *) arg_state;
|
||||||
@@ -448,7 +436,7 @@ setstate(arg_state)
|
|||||||
end_ptr = &state[rand_deg]; /* set end_ptr too */
|
end_ptr = &state[rand_deg]; /* set end_ptr too */
|
||||||
return(ostate);
|
return(ostate);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* random:
|
* random:
|
||||||
|
|||||||
Reference in New Issue
Block a user