Loading...
Searching...
No Matches
rand.h
Go to the documentation of this file.
/**********************************************************************
rand.h - Pseudo random number generator.
Copyright (C) 1998-2001 by OpenEye Scientific Software, Inc.
Some portions Copyright (C) 2001-2006 by Geoffrey R. Hutchison
This file is part of the Open Babel project.
For more information, see <http://openbabel.org/>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
***********************************************************************/
#ifndef RAND_H
#define RAND_H
#include <openbabel/babelconfig.h>
namespace OpenBabel
{
//******************************************
//*** Stuff for random number generation ***
//******************************************
typedef struct
{
unsigned int hi;
unsigned int lo;
}
DoubleType;
class OBRandom
{
DoubleType d;
unsigned int m,a,c;
unsigned int p;
unsigned int i;
unsigned int x;
bool OBRandomUseSysRand;
public:
OBRandom(bool useSys= false);
void Seed(int seed)
{
x = seed;
}
void TimeSeed();
int NextInt();
double NextFloat();
};
} // end namespace OpenBabel
#endif // RAND_H
OpenBabel::OBRandom::NextInt
int NextInt()
Definition rand.cpp:466
OpenBabel::OBRandom::Seed
void Seed(int seed)
Use seed for the random number generator seed.
Definition rand.h:78
OpenBabel::OBRandom::TimeSeed
void TimeSeed()
Definition rand.cpp:501
OpenBabel::OBRandom::OBRandom
OBRandom(bool useSys=false)
Constructor. useSys will use the system rand() function.
Definition rand.cpp:454
OpenBabel::OBRandom::NextFloat
double NextFloat()
Definition rand.cpp:483
OpenBabel
Global namespace for all Open Babel code.
Definition alias.h:23
OpenBabel::DoubleType
Used for internal random number generation OBRandom (unless the system random generator is used).
Definition rand.h:35
OpenBabel::DoubleType::hi
unsigned int hi
Definition rand.h:36
OpenBabel::DoubleType::lo
unsigned int lo
Definition rand.h:37