1d1c90ca8SAxel Dörfler/* Copyright (C) 1995, 1996, 1997, 1998, 2001 Free Software Foundation, Inc.
2d1c90ca8SAxel Dörfler   This file is part of the GNU C Library.
3d1c90ca8SAxel Dörfler   Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
4d1c90ca8SAxel Dörfler
5d1c90ca8SAxel Dörfler   The GNU C Library is free software; you can redistribute it and/or
6d1c90ca8SAxel Dörfler   modify it under the terms of the GNU Lesser General Public
7d1c90ca8SAxel Dörfler   License as published by the Free Software Foundation; either
8d1c90ca8SAxel Dörfler   version 2.1 of the License, or (at your option) any later version.
9d1c90ca8SAxel Dörfler
10d1c90ca8SAxel Dörfler   The GNU C Library is distributed in the hope that it will be useful,
11d1c90ca8SAxel Dörfler   but WITHOUT ANY WARRANTY; without even the implied warranty of
12d1c90ca8SAxel Dörfler   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13d1c90ca8SAxel Dörfler   Lesser General Public License for more details.
14d1c90ca8SAxel Dörfler
15d1c90ca8SAxel Dörfler   You should have received a copy of the GNU Lesser General Public
16d1c90ca8SAxel Dörfler   License along with the GNU C Library; if not, write to the Free
17d1c90ca8SAxel Dörfler   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18d1c90ca8SAxel Dörfler   02111-1307 USA.  */
19d1c90ca8SAxel Dörfler
20d1c90ca8SAxel Dörfler#include <stdlib.h>
21d1c90ca8SAxel Dörfler#include <limits.h>
22d1c90ca8SAxel Dörfler
23d1c90ca8SAxel Dörflerint
24d1c90ca8SAxel Dörfler__srand48_r (seedval, buffer)
25d1c90ca8SAxel Dörfler     long int seedval;
26d1c90ca8SAxel Dörfler     struct drand48_data *buffer;
27d1c90ca8SAxel Dörfler{
28d1c90ca8SAxel Dörfler  /* The standards say we only have 32 bits.  */
29d1c90ca8SAxel Dörfler  if (sizeof (long int) > 4)
30d1c90ca8SAxel Dörfler    seedval &= 0xffffffffl;
31d1c90ca8SAxel Dörfler
32d1c90ca8SAxel Dörfler  buffer->__x[2] = seedval >> 16;
33d1c90ca8SAxel Dörfler  buffer->__x[1] = seedval & 0xffffl;
34d1c90ca8SAxel Dörfler  buffer->__x[0] = 0x330e;
35d1c90ca8SAxel Dörfler
36d1c90ca8SAxel Dörfler  buffer->__a = 0x5deece66dull;
37d1c90ca8SAxel Dörfler  buffer->__c = 0xb;
38d1c90ca8SAxel Dörfler  buffer->__init = 1;
39d1c90ca8SAxel Dörfler
40d1c90ca8SAxel Dörfler  return 0;
41d1c90ca8SAxel Dörfler}
42d1c90ca8SAxel Dörflerweak_alias (__srand48_r, srand48_r)
43