# New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Make your voice heard! Participate in the 2020 Wisdom of Crowds® Survey. BEGIN SURVEY
Partner

## Rand Function

Hi, experts, i would like to know if there is a way to use the rand function but i pass the posible value, not only 1 or 0

i want to create random data but i provide the possible numbers, only create rando using that list of numbers

thank you a lot

Fernando

Tags (2)
2 Replies
Highlighted
MVP & Luminary

## Re: Rand Function

Rand() only returns a numbers between 0 and 1. You can use the result of rand to select from a list of numbers using various arithmetic and rounding operations. Some examples:

=ceil(rand()*1000,100)   // Generate a number between 100 and 1000 in multiples of 100

=pick(ceil(rand()*5), '12', '15', '27', '3', '44')   // Picks randomly from these 5 values.

-Rob

Highlighted
Partner

## Re: Rand Function

I suppose you can do something like this.

mapNumbers:

ID, Number

1, 3333

2, 5555

3, 1337

4, 5433

5, 11

6, 5432

7, 1223

8, 332

];

let vNoOfNumbers = NoOfRows('MapNumbers');

Fact:

applymap('mapNumbers',ceil(rand()*'\$(vNoOfNumbers)'),null()) as RandomSelectedNumber

From

.

.

.

If you want to read the possible numbers from a file you would do:

mapNumbers:

mapping load rowno() as ID, Number from File.