@Random is not working as it should!

Hi,

I am trying to use the @Random function but it is not working for me. I have this code in a computed field, what it is suppose to give me is from 1 to 4; this code is giving me from 1 to 5…

randomNum := @Round( 4 *@Random +1);

@Text(randomNum);

If I remove the +1 from the code then I get from 0 to 4…

How can I make this function work so that I get the value from 1 to 4… the 4 is a value that is dynamic… the field that goes there is MaxNumber and is computed, in this example it is 4

thanks

Paul,

Subject: @Random is not working as it should !

The answer is staring at you, but sometimes it takes a second set of eyes. If you are adding one to make certain the lowest number is always one, you must subtract to make certain the top is never more than 4…so: randomNum := @Round( (4-1) *@Random +1); @Text(randomNum);

Subject: RE: @Random is not working as it should !

Thanks Peter… it is working fine now…

Subject: RE: @Random is not working as it should !

Somewhere in this thread is some kind of joke about ‘robbing peter to pay paul’…

</off topic attempt at humor>

Subject: RE: @Random is not working as it should !

------QUOTE------Somewhere in this thread is some kind of joke about ‘robbing peter to pay paul’…

------END QUOTE------

FUNNY!!! I for one appreciate the humor!!!