ftp.nice.ch/pub/next/developer/resources/libraries/libcoll.940725.s.tar.gz#/libcoll-940725/coll/RandomBerkeley.h

This is RandomBerkeley.h in view mode; [Download] [Up]

#ifndef __RandomBerkeley_h_INCLUDE_GNU
#define __RandomBerkeley_h_INCLUDE_GNU

/*
 * Copyright (c) 1983 Regents of the University of California.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms are permitted
 * provided that the above copyright notice and this paragraph are
 * duplicated in all such forms and that any documentation,
 * advertising materials, and other materials related to such
 * distribution and use acknowledge that the software was developed
 * by the University of California, Berkeley.  The name of the
 * University may not be used to endorse or promote products derived
 * from this software without specific prior written permission.
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 */

/*
 * This is derived from the Berkeley source:
 *	@(#)random.c	5.5 (Berkeley) 7/6/88
 * It was reworked for the GNU C Library by Roland McGrath.
 * It was reworked for the GNU Objective-C Library by R. Andrew McCallum
 */

/* For each of the currently supported random number generators, we have a
   break value on the amount of state information (you need at least thi
   bytes of state info to support this random number generator), a degree for
   the polynomial (actually a trinomial) that the R.N.G. is based on, and
   separation between the two lower order coefficients of the trinomial.  */

/* Linear congruential.  */
#define	TYPE_0		0
#define	BREAK_0		8
#define	DEG_0		0
#define	SEP_0		0

/* x**7 + x**3 + 1.  */
#define	TYPE_1		1
#define	BREAK_1		32
#define	DEG_1		7
#define	SEP_1		3

/* x**15 + x + 1.  */
#define	TYPE_2		2
#define	BREAK_2		64
#define	DEG_2		15
#define	SEP_2		1

/* x**31 + x**3 + 1.  */
#define	TYPE_3		3
#define	BREAK_3		128
#define	DEG_3		31
#define	SEP_3		3

/* x**63 + x + 1.  */
#define	TYPE_4		4
#define	BREAK_4		256
#define	DEG_4		63
#define	SEP_4		1

#include <coll/Random.h>

@interface RandomBerkeley : Random
{
  int foo[2];
  long int randtbl[DEG_3 + 1];
  long int *fptr;
  long int *rptr;
  long int *state;
  int rand_type;
  int rand_deg;
  int rand_sep;
  long int *end_ptr;
}

- setRandomSeedFromClock;
- (long) _nextRandom;

- (void) _srandom: (unsigned int)x;
- (void*) _initstateSeed: (unsigned int)seed 
     state: (void*)arg_state 
     size: (size_t)n;
- (void*) _setstate: (void*)arg_state;

@end

#endif /* __RandomBerkeley_h_INCLUDE_GNU */

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.