text changes or conversion to -mdoc (version 3)
[unix-history] / usr / src / lib / libc / stdlib / rand.c
CommitLineData
9e7fde94
KB
1/*-
2 * Copyright (c) 1990 The Regents of the University of California.
3 * All rights reserved.
4 *
5 * %sccs.include.redist.c%
bb0cfa24
DF
6 */
7
2ce81398 8#if defined(LIBC_SCCS) && !defined(lint)
f0a345ab 9static char sccsid[] = "@(#)rand.c 5.5 (Berkeley) %G%";
9e7fde94 10#endif /* LIBC_SCCS and not lint */
bb0cfa24 11
9e7fde94 12#include <sys/types.h>
9e7fde94 13#include <stdlib.h>
c4e825e1 14
9e7fde94
KB
15static u_long next = 1;
16
17int
18rand()
c4e825e1 19{
9e7fde94 20 return ((next = next * 1103515245 + 12345) % RAND_MAX);
c4e825e1
BJ
21}
22
9e7fde94
KB
23void
24srand(seed)
25u_int seed;
c4e825e1 26{
9e7fde94 27 next = seed;
c4e825e1 28}