#include <randy.h>
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 |
Definition at line 27 of file randy.h.
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.
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.
random | number |
created
,
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}.
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.
random | number |
created
,
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}.
oa | is tag for exclusion of zero | |
ob | is tag for exclusion of one |
Requirements : Numbers oa, ob has to be zeros or ones.
random | number |
created
,
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.
omi | is mean value | |
oss | is std. dev. |
Requirements : Number oss has to be non-negative.
double | created |
,
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.
omi | is mean value | |
oss | is std. dev. |
Requirements : Number oss has to be non-negative.
long | created |
,
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 ) ;
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.
random | number |
created
,
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 ) ;
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.
random | number |
created
,
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 >
omax | is upper bound of the generated number |
Requirements : Number omax has to be greater than 0.
random | number |
created
,
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 |
) |
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.
oa | is probability mark, e.g. from roullete wheel selection |
Requirements : Number oa is hoped to be from <0,1>.
0L | or 1L |
created
,
Definition at line 340 of file randy.cpp.
References give_double().
double move_to_bounds | ( | double | oa, | |
double | olow, | |||
double | ohigh | |||
) |
long move_to_bounds | ( | long | oa, | |
long | olow, | |||
long | ohigh | |||
) |
double round | ( | double | oa, | |
double | oprecision | |||
) |
The round ( oa, oprecision ) function rounds number oa to oprecision precision.
oa | is rounded number | |
oprecision | is precision |
Requirements : Number oprecision has to be positive.
oa | if oprecision is 0, rounded oa otherwise |
created
,
long round | ( | long | oa, | |
long | oprecision | |||
) |
The round ( oa, oprecision ) function rounds number oa to oprecision precision.
oa | is rounded number | |
oprecision | is precision |
Requirements : Number oprecision has to be positive.
oa | if oprecision is 0, rounded oa otherwise |
created
,
Definition at line 358 of file randy.cpp.
Referenced by give_double(), give_gauss_long(), and give_long().