Generating number between 1 to 9

This topic is 7086 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hi! I have to generate two numbers. One between 1 to 9 (1,2,3,4,5,6,7,8,9) and one between 1 to 26 (1,2,...,25,26). I tried the random function, but I only know how to generate from 1 to 100 or 1000... Anyone have a formula?? Thank you!

jca

Share on other sites

Hi! I have to generate two numbers. One between 1 to 9 (1,2,3,4,5,6,7,8,9) and one between 1 to 26 (1,2,...,25,26). I tried the random function, but I only know how to generate from 1 to 100 or 1000... Anyone have a formula?? Thank you!

jca

Int(Random*9)+1

Int(Random*9)+1

Share on other sites

If all you want are integers from 1 to 9, here is a simple calc -

Int( (Random* 9) + 1 )

To get it to 26, just replace the 9 with 26 in the calculation.

The +1 is necessary so that the ceiling number will be included.

Share on other sites

If all you want are integers from 1 to 9, here is a simple calc -

Int( (Random* 9) + 1 )

To get it to 26, just replace the 9 with 26 in the calculation.

The +1 is necessary so that the ceiling number will be included.

Share on other sites

thank you for your help... I had setup a much more complex script. that was looping until the number was between 1 and 26 hehe thank you!

Share on other sites

thank you for your help... I had setup a much more complex script. that was looping until the number was between 1 and 26 hehe thank you!

Share on other sites

This topic is 7086 days old. Please don't post here. Open a new topic instead.

Create an account

Register a new account