Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Chahine
Contributor
Contributor

Reproducible Random number using Rand()

Hi Everyone, 

How can I generate a reproducible set of Random Numbers for rgb color code I am using 

argb(200,rand()*225,rand()*225,rand()*225)

but it gives me every time different set of colors, is there another function ? 

 

Thank you 

 

1 Reply
edwin
Master II
Master II

everytime you reload your script, you will get a different random number (hence the name).  i use rand all the time and its hard to test esp if you need to reload multiple times.  what i do is rt after the table with the rand() number fields, i save it to a QVD and next time just load the QVD and comment out the table itself.

obviously, you need to change your script after the first run.  if manually changing the script is not acceptable, then you can automate it by first checking if the QVD exists, if so, load it else run the code that has the rand() and then save to QVD.