1 /*
2  * Copyright (c) 1993 Martin Birgmeier
3  * All rights reserved.
4  *
5  * You may redistribute unmodified or modified versions of this source
6  * code provided that the above copyright notice and this and the
7  * following conditions are retained.
8  *
9  * This software is provided ``as is'', and comes with no warranties
10  * of any kind. I shall in no event be liable for anything that happens
11  * to anyone/anything when using this software.
12  */
13 
14 #ifndef _RAND48_H_
15 #define _RAND48_H_
16 
17 #define _DEFAULT_SOURCE
18 #include <math.h>
19 #include <stdlib.h>
20 #include <stdint.h>
21 
22 /*
23  * rand48 family support
24  *
25  * Copyright (c) 1993 Martin Birgmeier
26  * All rights reserved.
27  *
28  * You may redistribute unmodified or modified versions of this source
29  * code provided that the above copyright notice and this and the
30  * following conditions are retained.
31  *
32  * This software is provided ``as is'', and comes with no warranties
33  * of any kind. I shall in no event be liable for anything that happens
34  * to anyone/anything when using this software.
35  */
36 
37 #define        _RAND48_SEED_0  (0x330e)
38 #define        _RAND48_SEED_1  (0xabcd)
39 #define        _RAND48_SEED_2  (0x1234)
40 #define        _RAND48_MULT_0  (0xe66d)
41 #define        _RAND48_MULT_1  (0xdeec)
42 #define        _RAND48_MULT_2  (0x0005)
43 #define        _RAND48_ADD     (0x000b)
44 
45 struct _rand48 {
46   unsigned short _seed[3];
47   unsigned short _mult[3];
48   unsigned short _add;
49 };
50 
51 extern NEWLIB_THREAD_LOCAL struct _rand48 _rand48;
52 
53 extern void __dorand48 (struct _rand48 *r, unsigned short[3]);
54 
55 #endif /* _RAND48_H_ */
56