bottom

Data Generation Functions

User Rating: / 0
PoorBest 

Data Generation Functions

Generation function are shortcut to the production set of rules. They allow to create random data in an expression.

RANGE(a,b[,precision]): number in a range

This function returns number randomly drawn between a and b. The precision of the generated number can be specified as the third argument, if not, number are integers.

RANDLIST(a,b,...,x): random item in a list

This function returns a value randomly drawn in the list a,b,...,x. Note that element "a" can occur more than "b" and, thus, "a" can have a higher probability than "b" to be drawn.

ALPHA(n): letters generation

This function returns a word of size n in lowercase, using letters from a to z.

WORD(n,alphabet): words generation

This function returns a word of size n, using letters from the specified alphabet. Example: WORD(5,1~@abcd) can return "~~da1"

DEC(n [,m[,sep]]): numbers generation

This function returns a number whose integer part contains n digits, decimal part contains m digits and these two parts are separated by sep. The parameters m and sep are optional, default values are '0' and '.'. Examples: DEC(5) returns 44578, DEC(2,2) returns 55.29, DEC(2,2,%) returns 55%29

SUMSEQ(sum,nbval,disp,prec) : Sequence of number

This function produces a sequence of nbval float number whose sum is equals to sum. each generated value is randomly selected around the mean of sump/nbval with a dispersion of +/- prec %. Produced values are rounded to prec decimals.

Time Functions

DATEOFF(date,offset,format): Date generation

This function returns a date computed from a basedate "date" and an offset in days "offset". The base date must be given with the format yyyy-mm-dd. The output format of the date is given by parameter "format" (using %d for the day, %m for the month and %Y for the year). Example: DATEOFF(2009-06-01,10,%d/%m/%Y) returns 11/06/2009.

TIMEOFF(time,offset,format): Time generation

This function returns a time computed from a basetime "time" and an offset in seconds "offset". The base time must be given with the format YYYY-MM-DD hh:mm:ss. The output format of the time is given by parameter "format" (using %H for hours, %M for minutes and %S for seconds, %Y for year, %d for day and %m for month).

Example: TIMEOFF(2009-01-01 12:15:00,123,%H:%M:%S) returns 12:17:03.

COLUMN(strval,n,sep): CSV field extraction

The COLUMN function extracts the nth column (starting from 1) of the strval string. This parameter must be a CSV record whose field separator is "sep". Example: COLUMN(hello:world:!,2,:) returns world.

NBCOL(strval,sep): CSV field size

This function returns the number of fields of strval string. This parameter must be a CSV record whose field separator is "sep". Example: NBCOL(hello:world:!,:) returns 3.

Add comment


Security code
Refresh