Open Babel  3.0
Namespaces | Macros | Functions | Variables
rand.cpp File Reference
#include <openbabel/babelconfig.h>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include "rand.h"
#include <time.h>

Namespaces

 OpenBabel
 

Macros

#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)
 
static void DoubleAdd (DoubleType *x, unsigned int y)
 
static void DoubleMultiply (unsigned int x, unsigned int y, DoubleType *z)
 
static int LeadingZeros (unsigned int x)
 
static unsigned int DoubleModulus (DoubleType *n, unsigned int d)
 
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)
 
static int DetermineSequence (unsigned int m, unsigned int *pm, unsigned int *pa, unsigned int *pc)
 
static 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.

Macro Definition Documentation

◆ True

#define True   1

◆ False

#define False   0

◆ IsEven

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

◆ IsOdd

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

◆ BothEven

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

◆ IsPrime

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

◆ HiPart

#define HiPart (   x)    (x>>16)

◆ LoPart

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

◆ MAXFACT

#define MAXFACT   10

◆ MAXPRIMES

#define MAXPRIMES   256