Generates an array of random numbers between given ranges. This module will be incorporated into the Common project when it is next updated.
module RandomNumCore <src_file="randmod.c"> { RandomNumParams+IPort2 &RandomNumParams; int num_vals => RandomNumParams.num_vals; float min_val => RandomNumParams.min_val; float max_val => RandomNumParams.max_val; int rseed => RandomNumParams.rseed; omethod+req+notify_inst ELL_RAND_update( .num_vals+read+notify+req, .min_val+read+notify+req, .max_val+read+notify+req, .rseed+read+notify, .out_vals+write ) = "ELL_RAND_update"; float+OPort2 out_vals[num_vals]; };
The RandomNumCore module generates an array of random numbers between specified maximum and minimum values. The resultant array has a type of float. The module also allows a seed value to be set. Pseudo-random numbers are generated from a seed value using a set algorithm. Normally the seed value is derived from a measured value such as key-press timing. However by using a definite value as the seed a constant, defined sequence of random numbers can be generated. This technique is used in the Ellipse project to generate predictable test data.
The RandomNumCore module will be placed into the Common project when that project is next updated. Accompanying Functional, UI and User macros will also be added to the Common project. However it was decided to include the RandomNumCore module with this project so that the Ellipse project could be released immediately.
&RandomNumParams
Reference to the parameter block, which contains real instances of the parameters for the RandomNumCore module.
num_vals
The number of random numbers that should be generated. The parameter is of type int. Normally the value of this parameter is found by referring to the parameter block, which is referenced by the &RandomNumParams input.
min_val max_val
The minimum and maximum values that define the range of the generated random numbers. The parameters are of type float. All generated random numbers will be between these two values. If the specifed minimum value is greater than the maximum value then the two parameters are swapped internally before the random numbers are generated. Normally the value of this parameter is found by referring to the parameter block, which is referenced by the &RandomNumParams input.
rseed
The seed value used to setup the random number generator. The parameter is of type int. If the seed value does not have a value then the random number generator is not reinitialized. If the seed value does have a specific value then the random number generator is reinitialized with that value every time the output is generated. Normally the value of this parameter is found by referring to the parameter block, which is referenced by the &RandomNumParams input.
out_vals[num_vals]
An array containing the generated random numbers. The array has a type of float.
For an example of the use of this module please see the ellipse user macro and the supplied EllipseEg example application.
iac_proj/ellipse/ell_mods.v contains the V definitions of the RandomNumCore module and the RandomNumParams parameter blocks. It also contains the definitions of the EllipseCore module and the EllipseParams parameter block. Further information on these modules can be found in the EllipseCore documentation.
The low-level EllipseMods library containing the module RandomNumCore does not specify a process. By default the express process will be used.
Andrew Dodd International AVS Centre
International AVS Centre Manchester Visualization Centre Manchester Computing University of Manchester Oxford Road Manchester United Kingdom M13 9PL
EllipseCore, Ellipse, ellipse, EllipseEg