1: /*
2: * Copyright (c) 1980 Regents of the University of California.
3: * All rights reserved. The Berkeley software License Agreement
4: * specifies the terms and conditions for redistribution.
5: */
6:
7: #if defined(LIBC_SCCS) && !defined(lint)
8: static char sccsid[] = "@(#)rand.c 5.2 (Berkeley) 3/9/86";
9: #endif LIBC_SCCS and not lint
10:
11: static long randx = 1;
12:
13: srand(x)
14: unsigned x;
15: {
16: randx = x;
17: }
18:
19: rand()
20: {
21: #ifdef pdp11
22: return(((randx = randx * 1103515245 + 12345)>>16) & 0x7fff);
23: #else
24: return((randx = randx * 1103515245 + 12345) & 0x7fffffff);
25: #endif
26: }
Defined functions
rand
defined in line
19; used 58 times
- in /usr/include/stdlib.h line
81
- in /usr/src/games/adventure/wizard.c line
94-95(2)
- in /usr/src/games/atc/update.c line
171
- in /usr/src/games/battlestar/externs.h line
19
- in /usr/src/games/boggle/boggle.c line
250-253(2)
- in /usr/src/games/btlgammon/btlgammon.c line
338-339(2),
537
- in /usr/src/games/cribbage/cards.c line
53
- in /usr/src/games/cribbage/crib.c line
172-174(2),
343,
354
- in /usr/src/games/hack/hack.mklev.c line
10-11(2)
- in /usr/src/games/hack/rnd.c line
3
- in /usr/src/games/hangman/getword.c line
4-6(3)
- in /usr/src/games/mille/mille.h line
119
- in /usr/src/games/monop/roll.c line
19,
34
- in /usr/src/games/phantasia/phant.h line
23
- in /usr/src/games/phantasia/setfiles.c line
32
- in /usr/src/games/robots/rnd_pos.c line
38-40(2)
- in /usr/src/games/sail/externs.h line
31
- in /usr/src/games/snake/snake.c line
459-460(2),
601,
802
- in /usr/src/games/trek/ranf.c line
20,
28
- in /usr/src/games/warp/util.h line
18-19(2),
28-29(2),
36-37(2)
- in /usr/src/games/warp/warp.c line
147,
154
- in /usr/src/libexec/identd/src/crypto.c line
98
- in /usr/src/new/OLD/apl/src/af.c line
26,
34,
57
- in /usr/src/new/PORT/apl/src/af.c line
26,
34,
57
- in /usr/src/new/PORT/dungeon/rtim.c line
83
- in /usr/src/usr.bin/uucp/gename.c line
69
- in /usr/src/usr.lib/libF77/rand_.c line
38-40(3),
48,
55
- in /usr/src/usr.sbin/ntp/ntp_proto.c line
844
srand
defined in line
13; used 32 times
Defined variables
randx
defined in line
11; used 5 times
sccsid
defined in line
8;
never used