rand.cpp File Reference

Pseudo random number generator. More...

#include <openbabel/babelconfig.h>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <openbabel/rand.h>
#include <time.h>

Namespaces

namespace  OpenBabel

Defines

#define True   1
#define False   0
#define IsEven(x)   (((x)&1)==0)
#define IsOdd(x)   (((x)&1)!=0)
#define BothEven(x, y)   IsEven((x)|(y))
#define IsPrime(x)   (!IsEven((x))&&IsOddPrime((x)))
#define HiPart(x)   (x>>16)
#define LoPart(x)   ((x)&0xffff)
#define MAXFACT   10
#define MAXPRIMES   256

Functions

static unsigned int isqrt (unsigned int val)
static int IsOddPrime (unsigned int x)
static int RelativelyPrime (unsigned int x, unsigned int y)
void DoubleAdd (DoubleType *, unsigned int)
void DoubleMultiply (unsigned int, unsigned int, DoubleType *)
static int LeadingZeros (unsigned int x)
unsigned int DoubleModulus (DoubleType *, unsigned int)
static int DeterminePotency (unsigned int m, unsigned int a)
static int DetermineFactors (unsigned int x, unsigned int *factors)
static unsigned int DetermineIncrement (unsigned int m)
int DetermineSequence (unsigned int m, unsigned int *pm, unsigned int *pa, unsigned int *pc)
void GenerateSequence (unsigned int p, unsigned int m, unsigned int a, unsigned int c)

Variables

static int primes [MAXPRIMES]


Detailed Description

Pseudo random number generator.


Define Documentation

#define True   1

#define False   0

#define IsEven (  )     (((x)&1)==0)

#define IsOdd (  )     (((x)&1)!=0)

#define BothEven ( x,
 )     IsEven((x)|(y))

#define IsPrime (  )     (!IsEven((x))&&IsOddPrime((x)))

#define HiPart (  )     (x>>16)

#define LoPart (  )     ((x)&0xffff)

#define MAXFACT   10

#define MAXPRIMES   256