Home | History | Annotate | Line # | Download | only in stdlib
      1  1.7     lukem /*	$NetBSD: srand48.c,v 1.7 2005/06/12 05:21:28 lukem Exp $	*/
      2  1.4     perry 
      3  1.1    brezak /*
      4  1.1    brezak  * Copyright (c) 1993 Martin Birgmeier
      5  1.1    brezak  * All rights reserved.
      6  1.1    brezak  *
      7  1.1    brezak  * You may redistribute unmodified or modified versions of this source
      8  1.1    brezak  * code provided that the above copyright notice and this and the
      9  1.1    brezak  * following conditions are retained.
     10  1.1    brezak  *
     11  1.1    brezak  * This software is provided ``as is'', and comes with no warranties
     12  1.1    brezak  * of any kind. I shall in no event be liable for anything that happens
     13  1.1    brezak  * to anyone/anything when using this software.
     14  1.1    brezak  */
     15  1.1    brezak 
     16  1.7     lukem #include <sys/cdefs.h>
     17  1.7     lukem #if defined(LIBC_SCCS) && !defined(lint)
     18  1.7     lukem __RCSID("$NetBSD: srand48.c,v 1.7 2005/06/12 05:21:28 lukem Exp $");
     19  1.7     lukem #endif /* LIBC_SCCS and not lint */
     20  1.7     lukem 
     21  1.3       jtc #include "namespace.h"
     22  1.1    brezak #include "rand48.h"
     23  1.1    brezak 
     24  1.3       jtc #ifdef __weak_alias
     25  1.6   mycroft __weak_alias(srand48,_srand48)
     26  1.3       jtc #endif
     27  1.1    brezak 
     28  1.1    brezak void
     29  1.1    brezak srand48(long seed)
     30  1.1    brezak {
     31  1.2       jtc 	__rand48_seed[0] = RAND48_SEED_0;
     32  1.2       jtc 	__rand48_seed[1] = (unsigned short) seed;
     33  1.5  christos 	__rand48_seed[2] = (unsigned short) ((unsigned long)seed >> 16);
     34  1.2       jtc 	__rand48_mult[0] = RAND48_MULT_0;
     35  1.2       jtc 	__rand48_mult[1] = RAND48_MULT_1;
     36  1.2       jtc 	__rand48_mult[2] = RAND48_MULT_2;
     37  1.2       jtc 	__rand48_add = RAND48_ADD;
     38  1.1    brezak }
     39