LibRan
0.1
Pseudo-random number distribution generator
|
Create a new LR_obj object and set some parameter values. More...
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "libran.h"
#include "urand/urand.h"
Go to the source code of this file.
Functions | |
LR_obj * | LR_new (LR_type t, LR_data_type d) |
LR_new(LR_type t, LR_data_type d) - create the LR object and preset some default parameter values. More... | |
int | LR_rm (LR_obj **o) |
LR_rm(LR_obj **o) - destroy the LR object and release allocated memory. More... | |
int | LR_check (LR_obj *o) |
LR_check(LR_obj *o) - check and fix the LR object parameters if possible. More... | |
Create a new LR_obj object and set some parameter values.
Use these methods to create the LR_obj
object by allocating memory, and set certain of the parameters to default values dependent on the random variate type given. Other of the routines set these LR_obj
object attributes or remove the object. Lastly there is a check method to correct any of the parameter values where possible. (E.g. the interval boundaries b > a, width s > 0, etc.)
The following code segment sets up a LR_obj
object to generate uniform distributed random variates on the interval (a=1, b=3).
Definition in file LRnew.c.
int LR_check | ( | LR_obj * | o | ) |
LR_check(LR_obj *o) - check and fix the LR object parameters if possible.
This method finds and addresses fixable errors. For example for those random variate distributions that use the interval end points (a,b) the check method will switch 'a' and 'b' if 'a' > 'b'. The other example is for those distributions that use 's' which generally relates to the width of the peak. This value should be positive and the check will take the absolute value of this value if negative.
However, non-fixable errors will raise an error, such as a=b in the first case or s=0 for the second case.
o | LR_obj pointer |
LR_obj* LR_new | ( | LR_type | t, |
LR_data_type | d | ||
) |
LR_new(LR_type t, LR_data_type d) - create the LR object and preset some default parameter values.
t | LR_type (e.g. LR_gausbm) |
d | LR_data_type (e.g. LR_double) |
int LR_rm | ( | LR_obj ** | o | ) |
LR_rm(LR_obj **o) - destroy the LR object and release allocated memory.
o | Address of LR_obj pointer |