lcong48.c revision 1.4
1/*	$OpenBSD: lcong48.c,v 1.4 2014/12/08 21:45:20 deraadt 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
17extern unsigned short __rand48_seed[3];
18extern unsigned short __rand48_mult[3];
19extern unsigned short __rand48_add;
20
21void
22lcong48(unsigned short p[7])
23{
24	lcong48_deterministic(p);
25	__rand48_deterministic = 0;
26}
27
28void
29lcong48_deterministic(unsigned short p[7])
30{
31	__rand48_deterministic = 1;
32	__rand48_seed[0] = p[0];
33	__rand48_seed[1] = p[1];
34	__rand48_seed[2] = p[2];
35	__rand48_mult[0] = p[3];
36	__rand48_mult[1] = p[4];
37	__rand48_mult[2] = p[5];
38	__rand48_add = p[6];
39}
40