Date: Sun, 26 Sep 2021 01:24:40 +0000 (GMT) Message-ID: <525947116.12009.1632619480011@9c5033e110b2> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_12008_900056468.1632619480011" ------=_Part_12008_900056468.1632619480011 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html RAND Function

# RAND Function

Contents:

=20

=20
=20
=20

=20
=20

The  `RAND` function generates a random real number between 0 an= d 1. The function accepts an optional integer parameter, which causes = the same set of random numbers to be generated with each job execution.
• This function generates values of Decimal type with fifteen digits of p= recision after the decimal point. If you want to see all digits in the gene= rated value, you might need to apply a different number format. See NUMFORMAT Function.
• New random numbers are generated within the browser, after each browser= refresh, and between subsequent job executions.

Optionally, you can insert an integer as a parameter.

• When this value is present, this seed value is used as= part of the random number generator such that its output is a set of pseud= o-random values, which are consistent between job executions.
• When the browser is refreshed, the random numbers remain consistent whe= n the seed value is present.
• This value must be a valid literal Integer value. For more information = on valid values, see Integ= er Data Type.
• Column references or functions returning Integer values are not support= ed.

## Basic Usage

Example:

=20

rand()

Ou= tput: For each row, generate a random number between 0 and 1 in th= e new `random` function.

Example with seed value:

=20

rand(2)

Ou= tput: For each row, generate a random number between 0 and 1 = in the new `random` f= unction. The generated random set of random values are consistent between j= ob executions and are, in part, governed by the seed value `2`.

## Syntax = and Arguments

There are no arguments for this function.

=20

rand([int_value])

Argument Required? Data Type Description
int_value N integer Integer literal

For more information on syntax standards, see Language Documentation Syntax Note= s.

### int_value

Optional Integer literal that is used to generate random numbers. Use of= a seed value ensures consistency of output between job executions.

• This value must be a valid literal Integer value. For more information = on valid values, see Integ= er Data Type.
• Literal numeric values should no= t be quoted. Quoted values are treated as strings.
• Multiple columns and wildcards are not supported.

Usage Notes:

Required? Data Type Example Value
No Integer literal `14 `

## Examples=

### Example - Random values

In the following example, the `random` column is generat= ed by the `RAND` function:

=20
=20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20
Transformation Name <= code>New formula `Single row formula` `rand()` `'random'`
=20

source random
A

`0.516845703365675`

B

```0.7111873630= 0207```

C

```0.7586860660= 27118```

D

```0.6401462557= 91255```

### Example - Type check fun= ctions

The `RAND` function is typically used to introduce = randomness of some kind in your data. In the following example, it is used = to perform sampling within your wider dataset.

Tip: Keep in mind that for larger datasets the applicat= ion displays only a sample of them. This method of randomization is applied= to the full dataset during job execution.

Source:

You want to extract a random sample of 20% of your set of orders for fur= ther study:

OrderId Qty ProdId
1001 30 Widgets
1002 10 Big Widgets
1003 5 Big Widgets
1004 40 Widgets
1005 80 Tiny Widgets
1006 20 Widgets
1007 100 Tiny Widgets

Transformation:

You can use the following transform to generate a random integer from on= e to 10:

=20
=20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20
Transformation Name <= code>New formula `Single row formula` `round(rand() * 10)` `'random'`
=20

You can now use the following transform to keep only the rows that conta= in random values that are in the top 20%, where the value is `9 or 10:`

``` =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 Transformation Name<= code>Filter rowsParameter: ConditionCustom formulaParameter: Type of formulaCustom singleParameter: Condition(random > 8)Parameter: ActionKeep matching rows =20 Results: NOTE: Since the results are randomized, your results mi= ght vary. OrderId Qty ProdId random 1005 80 Tiny Widgets 9 1007 100 Tiny Widgets 10 =20 See Also:=20 =20 =20 =20 Page:= =20 =20 =20 PI Function=20 =20 =20 =20 Page:= =20 =20 =20 Other Functions<= /a>=20 =20 =20 =20 Page:= =20 =20 =20 COALESCE Funct= ion=20 =20 =20 =20 Page:= =20 =20 =20 RANDBETWEEN= Function=20 =20 =20 =20 Page:= =20 =20 =20 URLPARAMS Fun= ction=20 =20 =20 =20 Page:= =20 =20 =20 SUFFIX Function<= /a>=20 =20 =20 =20 Page:= =20 =20 =20 IPTOINT Functio= n=20 =20 =20 =20 Page:= =20 =20 =20 DOMAIN Function<= /a>=20 =20 =20 =20 Page:= =20 =20 =20 SUBDOMAIN Fun= ction=20 =20 =20 =20 Page:= =20 =20 =20 HOST Function= =20 =20 =20 =20 Page:= =20 =20 =20 SOURCER= OWNUMBER Function=20 =20 =20 =20 Page:= =20 =20 =20 IPFROMINT Fun= ction=20 =20 =20 =20 Page:= =20 =20 =20 RAND Function= =20 =20 =20 =20 Page:= =20 =20 =20 CASE Function= =20 =20 =20 =20 Page:= =20 =20 =20 RANGE Function=20 =20 =20 =20 =20   ```
``` ------=_Part_12008_900056468.1632619480011-- ```