LibRan
0.1
Pseudo-random number distribution generator
|
Collection of methods to handle setting the various LR_obj parameters. More...
Go to the source code of this file.
Functions | |
int | LR_vset (LR_obj *o, char *x, va_list ap) |
LR_vset(LR_obj *o, char *x, va_list ap) - read and parse options. More... | |
int | LR_set (LR_obj *o, char x,...) |
LR_set(LR_obj *o, char x, ...) - set a single LR object parameter. More... | |
int | LR_set_all (LR_obj *o, char *x,...) |
LR_set_all(LR_obj *o, char *x, ...) - set all given LR object parameters. More... | |
Collection of methods to handle setting the various LR_obj parameters.
The LR_obj
contains many attributes for the various random variate distributions. These routines provide a simple interface for accomplishing initializing these attributes.
Here is an example of setting the end points for the uniformly distributed pseudo-random number generator.
Definition in file LRset.c.
int LR_set | ( | LR_obj * | o, |
char | x, | ||
... | |||
) |
LR_set(LR_obj *o, char x, ...) - set a single LR object parameter.
This routine is designed to set a single LR_obj
attribute as directed by the format character. See LR_vset()
for allowed list of format characters.
o | LR_obj object |
x | single character format |
... | optional argument |
int LR_set_all | ( | LR_obj * | o, |
char * | x, | ||
... | |||
) |
LR_set_all(LR_obj *o, char *x, ...) - set all given LR object parameters.
Set a collection of LR_obj
attributes. This routine has any number of arguments as defined by the format string (similar to printf() ).
See LR_vset() for list of allowed format string characters.
o | LR_obj object |
x | format string |
... | optional arguments |
int LR_vset | ( | LR_obj * | o, |
char * | x, | ||
va_list | ap | ||
) |
LR_vset(LR_obj *o, char *x, va_list ap) - read and parse options.
This function is similar to vprintf() where the optional arguments are scanned according to format *x. The function accesses additional arguments by using the context information designated by ap
. The program must execute va_start()
before calling this function, and call va_end()
afterward.
Generally there is no need to call this routine. Call LR_set_all()
instead.
However, the list of attributes handled is important - 'k','n', 'p', 'q', 'd', 'a', 'b', 'm', 's', and 'x'. Any other characters are ignored except causing a negative value to be returned representing the number of such ignored characters. A real error will result in a positive return value.
All other characters in the format string are an ignorable error.
The precision of the input values are governed by the LR_obj
LR_data_type
, except for 'k','n' which are int
only, and except for 'p','q' which are float
only.
o | LR_obj object |
x | controlling format string |
ap | additional arguments context information |