randy Class Reference

#include <randy.h>

List of all members.

Public Member Functions

double give_double (double olow, double ohigh, double oprecision, long oa=0, long ob=0)
double give_double (double olow, double ohigh, long oa=0, long ob=0)
double give_double (long oa=0, long ob=0)
double give_gauss_double (double omi=0.0, double oss=1.0)
long give_gauss_long (double omi=0.0, double oss=1.0)
long give_long (long olow, long ohigh, long oprecision)
long give_long (long olow, long ohigh)
long give_long (long omax)
void init (long orseed=-1)
 destructor
long is_less (double oa)
double move_to_bounds (double oa, double olow, double ohigh)
long move_to_bounds (long oa, long olow, long ohigh)
 randy (void)
double round (double oa, double oprecision)
long round (long oa, long oprecision)
 ~randy (void)
 constructor

Public Attributes

long rseed
 random seed

Detailed Description

Definition at line 27 of file randy.h.


Constructor & Destructor Documentation

randy ( void   )  [inline]

Definition at line 30 of file randy.h.

~randy ( void   )  [inline]

constructor

Definition at line 31 of file randy.h.


Member Function Documentation

double give_double ( double  olow,
double  ohigh,
double  oprecision,
long  oa = 0,
long  ob = 0 
)

The give_double ( olow, ohigh, oprecision, oa, ob ) returns random number from < olow ; ohigh > for a,b = {0,0} (default settings), from < olow ; ohigh ) for a,b = {0,1}, from ( olow ; ohigh > for a,b = {1,0}, from ( olow ; ohigh ) for a,b = {1,1} with the given precision oprecision.

Parameters:
olow is lower bound of the generated number
ohigh is upper bound of the generated number
oa is tag for exclusion of zero
ob is tag for exclusion of one

Requirements : Number olow has to be smaller than ohigh. Numbers oa, ob has to be zeros or ones.

Return values:
random number

created

Date
2004/03/19 14:32:14

,

Author
leps

Definition at line 322 of file randy.cpp.

References give_double(), and round().

double give_double ( double  olow,
double  ohigh,
long  oa = 0,
long  ob = 0 
)

The give_double ( olow, ohigh, oa, ob ) returns random number from < olow ; ohigh > for a,b = {0,0} (default settings), from < olow ; ohigh ) for a,b = {0,1}, from ( olow ; ohigh > for a,b = {1,0}, from ( olow ; ohigh ) for a,b = {1,1}.

Parameters:
olow is lower bound of the generated number
ohigh is upper bound of the generated number
oa is tag for exclusion of zero
ob is tag for exclusion of one

Requirements : Number olow has to be smaller than ohigh. Numbers oa, ob has to be zeros or ones.

Return values:
random number

created

Date
2004/03/19 14:32:14

,

Author
leps

Definition at line 285 of file randy.cpp.

References give_double().

double give_double ( long  oa = 0,
long  ob = 0 
)

The give_double ( oa, ob ) returns random number from < 0 ; 1 > for a,b = {0,0} (default settings), from < 0 ; 1 ) for a,b = {0,1}, from ( 0 ; 1 > for a,b = {1,0}, from ( 0 ; 1 ) for a,b = {1,1}.

Parameters:
oa is tag for exclusion of zero
ob is tag for exclusion of one

Requirements : Numbers oa, ob has to be zeros or ones.

Return values:
random number

created

Date
2004/03/19 14:32:14

,

Author
leps

Definition at line 247 of file randy.cpp.

References RAND_MAX, and rnd().

Referenced by give_double(), give_gauss_double(), is_less(), test_double(), and test_double_from().

double give_gauss_double ( double  omi = 0.0,
double  oss = 1.0 
)

The give_gauss_double ( omi, oss ) function returns random numbers with Gaussian normal distribution.

Parameters:
omi is mean value
oss is std. dev.

Requirements : Number oss has to be non-negative.

Return values:
double created
Date
2004/03/19 14:32:14

,

Author
leps

Definition at line 484 of file randy.cpp.

References give_double().

Referenced by give_gauss_long(), and test_gauss_double().

long give_gauss_long ( double  omi = 0.0,
double  oss = 1.0 
)

The give_gauss_long ( omi, oss ) function returns random numbers with Gaussian normal distribution.

Parameters:
omi is mean value
oss is std. dev.

Requirements : Number oss has to be non-negative.

Return values:
long created
Date
2004/03/19 14:32:14

,

Author
leps

Definition at line 465 of file randy.cpp.

References give_gauss_double(), and round().

long give_long ( long  olow,
long  ohigh,
long  oprecision 
)

The give_long ( long olow, long ohigh, long oprecision ) returns random number from < olow; ohigh > with the given precision oprecision. If the value from ( olow; ohigh ) is requested, the function have to be called as give_long ( olow+1 ; ohigh-1 ) ;

Parameters:
olow is (inclusive) lower bound of the generated number
ohigh is (inclusive) upper bound of the generated number
oprecision is precision of the generated number

Requirements : Number olow has to be smaller than ohigh.

Return values:
random number

created

Date
2004/03/19 14:32:14

,

Author
leps

Definition at line 225 of file randy.cpp.

References give_long(), and round().

long give_long ( long  olow,
long  ohigh 
)

The give_long ( long olow, long ohigh ) returns random number from < olow; ohigh >. If the value from ( olow; ohigh ) is requested, the function have to be called as give_long ( olow+1 ; ohigh-1 ) ;

Parameters:
olow is lower bound of the generated number
ohigh is upper bound of the generated number

Requirements : Number olow has to be smaller than ohigh.

Return values:
random number

created

Date
2004/03/19 14:32:14

,

Author
leps

Definition at line 192 of file randy.cpp.

References give_long().

long give_long ( long  omax  ) 

The give_long ( long omax ) returns random number from < 0; omax-1 >

Parameters:
omax is upper bound of the generated number

Requirements : Number omax has to be greater than 0.

Return values:
random number

created

Date
2004/03/19 14:32:14

,

Author
leps

Definition at line 159 of file randy.cpp.

References RAND_MAX, and rnd().

Referenced by give_long(), test_gauss_long(), test_long(), and test_long_from().

void init ( long  orseed = -1  ) 

destructor

initialization of rseed

The init function initialize random seed

Parameters:
orseed is user defined seed. If there is nothing, process will be pseudo-random

created

Date
2004/03/19 14:32:14

,

Author
leps

Definition at line 122 of file randy.cpp.

References rseed, and time.

Referenced by main().

long is_less ( double  oa  ) 

The is_less ( oa ) function returns 0 if random number form <0,1) is less than oa, returns 1 otherwise.

Parameters:
oa is probability mark, e.g. from roullete wheel selection

Requirements : Number oa is hoped to be from <0,1>.

Return values:
0L or 1L

created

Date
2004/03/19 14:32:14

,

Author
leps

Definition at line 340 of file randy.cpp.

References give_double().

double move_to_bounds ( double  oa,
double  olow,
double  ohigh 
)

The move_to_bounds ( oa, olow, ohigh ) move oa to interval <olow,ohigh>.

Parameters:
oa is input nuber
olow is lower bound
ohigh is upper bound
Return values:
number from <olow,ohigh>

created

Date
2004/03/19 14:32:14

,

Author
leps

Definition at line 441 of file randy.cpp.

long move_to_bounds ( long  oa,
long  olow,
long  ohigh 
)

The move_to_bounds ( oa, olow, ohigh ) move oa to interval <olow,ohigh>.

Parameters:
oa is input nuber
olow is lower bound
ohigh is upper bound
Return values:
number from <olow,ohigh>

created

Date
2004/03/19 14:32:14

,

Author
leps

Definition at line 388 of file randy.cpp.

double round ( double  oa,
double  oprecision 
)

The round ( oa, oprecision ) function rounds number oa to oprecision precision.

Parameters:
oa is rounded number
oprecision is precision

Requirements : Number oprecision has to be positive.

Return values:
oa if oprecision is 0, rounded oa otherwise

created

Date
2004/03/19 14:32:14

,

Author
leps

Definition at line 411 of file randy.cpp.

long round ( long  oa,
long  oprecision 
)

The round ( oa, oprecision ) function rounds number oa to oprecision precision.

Parameters:
oa is rounded number
oprecision is precision

Requirements : Number oprecision has to be positive.

Return values:
oa if oprecision is 0, rounded oa otherwise

created

Date
2004/03/19 14:32:14

,

Author
leps

Definition at line 358 of file randy.cpp.

Referenced by give_double(), give_gauss_long(), and give_long().


Member Data Documentation

long rseed

random seed

Definition at line 50 of file randy.h.

Referenced by init().


The documentation for this class was generated from the following files:

Generated by  doxygen 1.6.2