diff options
author | cvs2svn <admin@example.com> | 2025-04-14 17:32:06 +0000 |
---|---|---|
committer | cvs2svn <admin@example.com> | 2025-04-14 17:32:06 +0000 |
commit | eb8dd9dca1228af0cd132f515509051ecfabf6f6 (patch) | |
tree | edb6da6af7e865d488dc1a29309f1e1ec226e603 /src/lib/libc/stdlib/_rand48.c | |
parent | 247f0352e0ed72a4f476db9dc91f4d982bc83eb2 (diff) | |
download | openbsd-tb_20250414.tar.gz openbsd-tb_20250414.tar.bz2 openbsd-tb_20250414.zip |
This commit was manufactured by cvs2git to create tag 'tb_20250414'.tb_20250414
Diffstat (limited to 'src/lib/libc/stdlib/_rand48.c')
-rw-r--r-- | src/lib/libc/stdlib/_rand48.c | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/src/lib/libc/stdlib/_rand48.c b/src/lib/libc/stdlib/_rand48.c deleted file mode 100644 index 7c950f7cee..0000000000 --- a/src/lib/libc/stdlib/_rand48.c +++ /dev/null | |||
@@ -1,47 +0,0 @@ | |||
1 | /* $OpenBSD: _rand48.c,v 1.3 2005/08/08 08:05:36 espie Exp $ */ | ||
2 | /* | ||
3 | * Copyright (c) 1993 Martin Birgmeier | ||
4 | * All rights reserved. | ||
5 | * | ||
6 | * You may redistribute unmodified or modified versions of this source | ||
7 | * code provided that the above copyright notice and this and the | ||
8 | * following conditions are retained. | ||
9 | * | ||
10 | * This software is provided ``as is'', and comes with no warranties | ||
11 | * of any kind. I shall in no event be liable for anything that happens | ||
12 | * to anyone/anything when using this software. | ||
13 | */ | ||
14 | |||
15 | #include "rand48.h" | ||
16 | |||
17 | unsigned short __rand48_seed[3] = { | ||
18 | RAND48_SEED_0, | ||
19 | RAND48_SEED_1, | ||
20 | RAND48_SEED_2 | ||
21 | }; | ||
22 | unsigned short __rand48_mult[3] = { | ||
23 | RAND48_MULT_0, | ||
24 | RAND48_MULT_1, | ||
25 | RAND48_MULT_2 | ||
26 | }; | ||
27 | unsigned short __rand48_add = RAND48_ADD; | ||
28 | |||
29 | void | ||
30 | __dorand48(unsigned short xseed[3]) | ||
31 | { | ||
32 | unsigned long accu; | ||
33 | unsigned short temp[2]; | ||
34 | |||
35 | accu = (unsigned long) __rand48_mult[0] * (unsigned long) xseed[0] + | ||
36 | (unsigned long) __rand48_add; | ||
37 | temp[0] = (unsigned short) accu; /* lower 16 bits */ | ||
38 | accu >>= sizeof(unsigned short) * 8; | ||
39 | accu += (unsigned long) __rand48_mult[0] * (unsigned long) xseed[1] + | ||
40 | (unsigned long) __rand48_mult[1] * (unsigned long) xseed[0]; | ||
41 | temp[1] = (unsigned short) accu; /* middle 16 bits */ | ||
42 | accu >>= sizeof(unsigned short) * 8; | ||
43 | accu += __rand48_mult[0] * xseed[2] + __rand48_mult[1] * xseed[1] + __rand48_mult[2] * xseed[0]; | ||
44 | xseed[0] = temp[0]; | ||
45 | xseed[1] = temp[1]; | ||
46 | xseed[2] = (unsigned short) accu; | ||
47 | } | ||