Reputation: 83
I am quite new to Netlogo and I am experiencing the following problem. I want to give a variable a random number between 1 and 10, so without 0. Using the following code: set random 10
, netlogo will also pick 0 as a possibility. Is there any way to avoid this? Random-float works, but this does not select whole numbers. Thanks in advance for any help!
Max
Upvotes: 2
Views: 652
Reputation: 54
Use random 10 + 1
. random 10
generates a number from 0 to 9, adding 1 to it gives a range of 1 to 10.
Upvotes: 3