# 2.11BSD#431 - /usr/src/lib/libc/compat-4.1/rand.c

##### Functions

    rand              X
    srand             X

       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

- in /usr/include/stdlib.h line 83
- in /usr/src/games/adventure/init.c line 173
- in /usr/src/games/battlestar/init.c line 23
- in /usr/src/games/boggle/boggle.c line 580
- in /usr/src/games/btlgammon/btlgammon.c line 60
- in /usr/src/games/cribbage/cards.c line 28
- in /usr/src/games/hack/hack.main.c line 214
- in /usr/src/games/hack/hack.unix.c line 32
- in /usr/src/games/hangman/setup.c line 27
- in /usr/src/games/mille/mille.h line 118
- in /usr/src/games/monop/monop.c line 11
- in /usr/src/games/phantasia/func1.c line 429
- in /usr/src/games/phantasia/setfiles.c line 28
- in /usr/src/games/robots/main.c line 105
- in /usr/src/games/sail/main.c line 27
- in /usr/src/games/snake/snake.c line 124
- in /usr/src/games/trek/main.c line 139
- in /usr/src/games/trek/setup.c line 80
- in /usr/src/games/warp/warp.c line 325
- in /usr/src/libexec/identd/src/crypto.c line 96
- in /usr/src/new/OLD/apl/src/a0.c line 79
- in /usr/src/new/OLD/apl/src/a9.c line 48
- in /usr/src/new/OLD/apl/src/aj.c line 22
- in /usr/src/new/PORT/apl/src/a0.c line 79
- in /usr/src/new/PORT/apl/src/a9.c line 48
- in /usr/src/new/PORT/apl/src/aj.c line 22
- in /usr/src/new/PORT/dungeon/rtim.c line 70
- in /usr/src/usr.bin/uucp/gename.c line 66
- in /usr/src/usr.lib/libF77/rand_.c line 36, 47, 54
- in /usr/src/usr.sbin/ntp/ntpd.c line 335

#### Defined variables

randx defined in line 11; used 5 times

- in line 16, 22-24(4)

sccsid defined in line 8; never used

Last modified: 1987-07-12 Generated: 2016-12-26 | Generated by src2html V0.67 page hit count: ?E00 |