diff options
author | Elliott Hughes <enh@google.com> | 2012-10-01 14:14:21 -0700 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2012-10-01 14:14:21 -0700 |
commit | 31a1060a5a75d4f2aa3c3a5a7b948eb512d53387 (patch) | |
tree | 7b7445b27b4503c07d53c1fff9173b7dacf167b8 /libc/upstream-netbsd | |
parent | cd195eba1f9235b9b9d4dda70142d927b1b9802d (diff) | |
download | bionic-31a1060a5a75d4f2aa3c3a5a7b948eb512d53387.zip bionic-31a1060a5a75d4f2aa3c3a5a7b948eb512d53387.tar.gz bionic-31a1060a5a75d4f2aa3c3a5a7b948eb512d53387.tar.bz2 |
Upgrade seed48 too.
Missed this in 774c7f54ff375d71106283d42779b0cc5f238f87.
Change-Id: Ic24fd67f003d0e2d192cfb08f96f63024ca817eb
Diffstat (limited to 'libc/upstream-netbsd')
-rw-r--r-- | libc/upstream-netbsd/libc/stdlib/seed48.c | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/libc/upstream-netbsd/libc/stdlib/seed48.c b/libc/upstream-netbsd/libc/stdlib/seed48.c new file mode 100644 index 0000000..36c0570 --- /dev/null +++ b/libc/upstream-netbsd/libc/stdlib/seed48.c @@ -0,0 +1,49 @@ +/* $NetBSD: seed48.c,v 1.8 2005/06/12 05:21:28 lukem Exp $ */ + +/* + * Copyright (c) 1993 Martin Birgmeier + * All rights reserved. + * + * You may redistribute unmodified or modified versions of this source + * code provided that the above copyright notice and this and the + * following conditions are retained. + * + * This software is provided ``as is'', and comes with no warranties + * of any kind. I shall in no event be liable for anything that happens + * to anyone/anything when using this software. + */ + +#include <sys/cdefs.h> +#if defined(LIBC_SCCS) && !defined(lint) +__RCSID("$NetBSD: seed48.c,v 1.8 2005/06/12 05:21:28 lukem Exp $"); +#endif /* LIBC_SCCS and not lint */ + +#include "namespace.h" + +#include <assert.h> + +#include "rand48.h" + +#ifdef __weak_alias +__weak_alias(seed48,_seed48) +#endif + +unsigned short * +seed48(unsigned short xseed[3]) +{ + static unsigned short sseed[3]; + + _DIAGASSERT(xseed != NULL); + + sseed[0] = __rand48_seed[0]; + sseed[1] = __rand48_seed[1]; + sseed[2] = __rand48_seed[2]; + __rand48_seed[0] = xseed[0]; + __rand48_seed[1] = xseed[1]; + __rand48_seed[2] = xseed[2]; + __rand48_mult[0] = RAND48_MULT_0; + __rand48_mult[1] = RAND48_MULT_1; + __rand48_mult[2] = RAND48_MULT_2; + __rand48_add = RAND48_ADD; + return sseed; +} |