home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / mint / gcc / gcc261c.zoo / objects / RNGBerkeley.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-18  |  2.6 KB  |  75 lines

  1. /* Interface for Berkeley random()-compatible generation for Objective-C
  2.  
  3.    Reworked by:  R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
  4.    Date: May 1993
  5.  
  6.    This file is part of the GNU Objective C Class Library.
  7.  
  8.    This library is free software; you can redistribute it and/or
  9.    modify it under the terms of the GNU Library General Public
  10.    License as published by the Free Software Foundation; either
  11.    version 2 of the License, or (at your option) any later version.
  12.    
  13.    This library is distributed in the hope that it will be useful,
  14.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  15.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  16.    Library General Public License for more details.
  17.  
  18.    You should have received a copy of the GNU Library General Public
  19.    License along with this library; if not, write to the Free
  20.    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  21. */ 
  22.  
  23. #ifndef __RNGBerkeley_h_INCLUDE_GNU
  24. #define __RNGBerkeley_h_INCLUDE_GNU
  25.  
  26. /*
  27.  * Copyright (c) 1983 Regents of the University of California.
  28.  * All rights reserved.
  29.  *
  30.  * Redistribution and use in source and binary forms are permitted
  31.  * provided that the above copyright notice and this paragraph are
  32.  * duplicated in all such forms and that any documentation,
  33.  * advertising materials, and other materials related to such
  34.  * distribution and use acknowledge that the software was developed
  35.  * by the University of California, Berkeley.  The name of the
  36.  * University may not be used to endorse or promote products derived
  37.  * from this software without specific prior written permission.
  38.  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  39.  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  40.  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  41.  */
  42.  
  43. /*
  44.  * This is derived from the Berkeley source:
  45.  *    @(#)random.c    5.5 (Berkeley) 7/6/88
  46.  * It was reworked for the GNU C Library by Roland McGrath.
  47.  * It was reworked for the GNU Objective-C Library by R. Andrew McCallum
  48.  */
  49.  
  50. #include <objects/stdobjects.h>
  51. #include <objects/RandomGenerating.h>
  52.  
  53. @interface RNGBerkeley : Object <RandomGenerating>
  54. {
  55.   int foo[2];
  56.   long int randtbl[32];  /* Size must match DEG_3 + 1 from RNGBerkeley.m */
  57.   long int *fptr;
  58.   long int *rptr;
  59.   long int *state;
  60.   int rand_type;
  61.   int rand_deg;
  62.   int rand_sep;
  63.   long int *end_ptr;
  64. }
  65.  
  66. - (void) _srandom: (unsigned int)x;
  67. - (void*) _initstateSeed: (unsigned int)seed 
  68.      state: (void*)arg_state 
  69.      size: (size_t)n;
  70. - (void*) _setstate: (void*)arg_state;
  71.  
  72. @end
  73.  
  74. #endif /* __RNGBerkeley_h_INCLUDE_GNU */
  75.