Random Number within an specific range

195 views
Skip to first unread message

RF

unread,
Aug 13, 2015, 2:56:33 PM8/13/15
to MapInfo-L
Hello Listers,

I've been using the Rnd() function which generates a  float number between 0 and 1. I'm interested in generating a random number between an specific range of numbers, i.e. between 1 and 3. Not sure how to accomplish this.

Roger

Uffe Kousgaard

unread,
Aug 13, 2015, 4:29:04 PM8/13/15
to mapi...@googlegroups.com
Hi,

Try:
int(Rnd(1)*3+1)

Regards
Uffe Kousgaard

RF wrote:
--
--
You received this message because you are subscribed to the
Google Groups "MapInfo-L" group.To post a message to this group, send
email to mapi...@googlegroups.com
To unsubscribe from this group, go to:
http://groups.google.com/group/mapinfo-l/subscribe?hl=en
For more options, information and links to MapInfo resources (searching
archives, feature requests, to visit our Wiki, visit the Welcome page at
http://groups.google.com/group/mapinfo-l?hl=en

---
You received this message because you are subscribed to the Google Groups "MapInfo-L" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mapinfo-l+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

RF

unread,
Aug 13, 2015, 5:02:43 PM8/13/15
to MapInfo-L
Uffe,

Thank you for the suggestion, it works. The 3 represents the upper limit of the range. I will try to figure out how to make it work for some other ranges, 10 to 30, .... # to #.

Will post the results.

Thanks!

Roger
Reply all
Reply to author
Forward
0 new messages