Commit | Line | Data |
---|---|---|
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 | 9 | static 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 |
15 | static u_long next = 1; |
16 | ||
17 | int | |
18 | rand() | |
c4e825e1 | 19 | { |
9e7fde94 | 20 | return ((next = next * 1103515245 + 12345) % RAND_MAX); |
c4e825e1 BJ |
21 | } |
22 | ||
9e7fde94 KB |
23 | void |
24 | srand(seed) | |
25 | u_int seed; | |
c4e825e1 | 26 | { |
9e7fde94 | 27 | next = seed; |
c4e825e1 | 28 | } |