This object is in archive! 

Random function - does not seem to work

Pascal Verstappen shared this problem 10 years ago
Known

Hello,


I have created a simple presence-simulation-rule based on an example given in this forum (the one given by Sebastian Popovic):

https://community.zipato.com/responses/someone-to-help-me-understand-whats-wrong-with-this-rule-


I cannot get the rule to work properly, I have added several email-action (for debugging) and have managed to find out that the 'random between' is causing the issue.

I have it now set to 'random between 4 and 6 = 5', however it never generates the value 5. Once changed to 'random between 5 and 5 = 5' works fine... however why use the randomiser then ;).


Anyone any suggestions?


See below for a quick screenshot of the rule:


8IZ4eekcpSbjSO3HFtle

Best Answer
photo

I just realized my mistake:

Numbers created by random blocks are real numbers, not integers. If you use it like this, you have more than 1000 times better chance of getting euromillions jackpot twice in a row than to get exactly 5. If you want 1/3 chance and you don't need the random number, do something like this:

  1. if random between 0 and 3 < 1

or

  1. if random between 0 and 100 < 33.333

Replies (2)

photo
1

I just realized my mistake:

Numbers created by random blocks are real numbers, not integers. If you use it like this, you have more than 1000 times better chance of getting euromillions jackpot twice in a row than to get exactly 5. If you want 1/3 chance and you don't need the random number, do something like this:

  1. if random between 0 and 3 < 1

or

  1. if random between 0 and 100 < 33.333

photo
1

Thx for your response Sebastian - are there any plans for the random-function to create integers?


Thx

Leave a Comment
 
Attach a file