Loading...
Searching...
No Matches
rand.cpp File Reference
`#include <openbabel/babelconfig.h>`
`#include <stdlib.h>`
`#include <stdio.h>`
`#include <math.h>`
`#include "rand.h"`
`#include <time.h>`

## Namespaces

namespace | OpenBabel

## Macros

#define | True 1
#define | False 0
#define | IsEven(x)
#define | IsOdd(x)
#define | BothEven(x, y)
#define | IsPrime(x)
#define | HiPart(x)
#define | LoPart(x)
#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

Referenced by OpenBabel::DetermineSequence(), and OpenBabel::IsOddPrime().

## False

#define False 0

Referenced by OpenBabel::DetermineSequence(), OpenBabel::IsOddPrime(), and OpenBabel::RelativelyPrime().

## IsEven

#define IsEven | ( |  | x | ) |

Value:
(((x)&1)==0)

Referenced by OpenBabel::RelativelyPrime().

## IsOdd

#define IsOdd | ( |  | x | ) |

Value:
(((x)&1)!=0)

## BothEven

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

Value:
IsEven((x)|(y))
IsEven
#define IsEven(x)
Definition rand.cpp:49

Referenced by OpenBabel::RelativelyPrime().

## IsPrime

#define IsPrime | ( |  | x | ) |

Value:
(!IsEven((x))&&IsOddPrime((x)))

## HiPart

#define HiPart | ( |  | x | ) |

Value:
(x>>16)

Referenced by OpenBabel::DoubleModulus(), and OpenBabel::DoubleMultiply().

## LoPart

#define LoPart | ( |  | x | ) |

Value:
((x)&0xffff)

Referenced by OpenBabel::DoubleModulus(), and OpenBabel::DoubleMultiply().

## MAXFACT

#define MAXFACT 10

Referenced by OpenBabel::DetermineSequence().

## MAXPRIMES

#define MAXPRIMES 256

Referenced by OpenBabel::DetermineFactors(), and OpenBabel::IsOddPrime().