rand function

The rand function returns a random column with the specified number of elements. If the number of elements is specified, a random column is created with n (n=number of rows) elements. The column is filled with values following a random distribution [0,1].


Parameters

rand(n,seed)

Parameter

Description

n

The number of rows to fill with random values. Its default value corresponds to the number of rows of the dataset.

seed

A base value, used to generate random values. It makes the random generation deterministic.


Example

The following example uses the Bike Sales dataset.

This example isn’t based on a real scenario, it only explains how to use the function.

Description

Screenshot

In this example, we want to add a new column and to fill only 10 rows of it, with 5 as the base value.

Add a new column, then type the following formula: rand(10,5)