Random

<< Click to Display Table of Contents >>

Navigation:  Reference > Transforms >

Random

Description

Adds a new column, filled with pseudo-random numbers.

 

Example

Add a new column of random real values between -1 and +1:

 

pseudo-random number generator

 

Inputs

One.

 

Options

Set New column name to the name of the new column you want to create.

Set Type depending on whether you wish to generate Real (floating point) or Integer (whole number) values.

Set Seed to the seed value used by the pseudo-random generator algorithm.

Set Minimum to the minimum value you want to generate. The value may be equal to minimum, but not less.

Set Maximum to the maximum value you want to generate. The value may be equal to maximum, but not more.

 

Notes

The numbers output are a sequence of pseudo-random numbers based on the Seed value.

The same sequence is always output for the same options.

The default Seed value is based on the system clock when the transform was first created.

To generate random text (strings) use Random with Type set to Integer and then use the results in conjunction with Lookup to lookup text values using an integer key.  

To generate random dates or datetimes then use Random with Type set to Integer and then use the results in conjunction with Calculate with Operation set to MSecsToDateTime.

To generate a real random value between numerical values in Min and Max data columns:

oGenerate real values between 0 and 1 using Random.

oUse the Javascript transform to calculate a new value in the desired range, e.g.:

 

return ( $(Max) - $(Min) ) * $(Random) + $(Min);

 

To generate passwords use Random in conjunction with the Hash transform.

New columns are always added at the right end. You can change the column order with Reorder Cols.

You can use the Correlate transform to check sets of random numbers are not correlated. This show the very low correlation between 2 sets of 1,000,000 values between 0.0 and 1.0 generated by Random using seeds 0 and 1:

 

correlating pseudo random numbers

 

See also

Sample