Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Folks,
The doco for rand() merely says it returns a number between 0 and 1, which I'd ordinarily take to mean that it would never return 0 or 1 exactly. But years of experience have taught me to not make such assumptions to quickly!
So, can anyone tell me if 0 and 1 themselves are meant to be possible return values from rand()?
Thanks & regards,
Angus.
Rand() function is exclusive of 0 and 1.
As per my experience and usage....its EXCLUSIVE of 0 and 1. as correctly mentioned by QlikView. It generates a random number between 0 and 1.
Regards!!!
Hi Angus,
Rand() function excludes 0 & 1.
It will generate a random number between 0 & 1 excluding them.
If 0 or 1 are valid values for you, it will depend on the precision you are working with. I mean if you round or multiply the Rand() value, you can get 0.0001, and depending on your precision this could be treated as 0. The same for 0.9999
By way of rounding-out this discussion, I've discovered rand() presently can return a value >1. See here in QlikBug for more information:
http://community.qlik.com/message/393605?et=watches.email.thread#393605
Angus.
Indeed. But it should never be equal to 0 or 1..