The `RAND`

function generates a random rea=
l number between 0 and 1. This function uses no parameters. Generated =
values are of Decimal type and have fifteen digits of precision after the d=
ecimal point. If you want to see all digits in the generated value, you mig=
ht need to apply a different number format. See NUMFORMAT Function.

derive type:single value: RAND() as:= 'random'

**Output:** For each row, generate a random number between =
0 and 1 in the new `random`

function.

There are no arguments for this function.

**Tip:** For additional examples, see Common Tasks.

In the following example, the source is simply the `source column, and the `

`random`

column is generated by the&nbs=
p;`RAND`

function:

```
=20
```derive type:single value:RAND() as:'=
random'

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=
when the panel 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

**Transform:**

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

=20
derive type:single value:round(RAND(=
) * 10) as:'random'

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
```keep row:(random > 8)

**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

```
------=_Part_58094_1501117323.1635445253644--
```