This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Another easy question... about making random numbers...

Old posts that have not been replied to for several years.
Locked
O
OnFire
Voice
Posts: 23
Joined: Tue Oct 01, 2002 1:51 pm

Another easy question... about making random numbers...

Post by OnFire »

How can I make a string be a random number?

I think it's got something to do with arrays, but all tcl-commands.doc says isn't good enough!

Cheers
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Post by Papillon »

Code: Select all

set string [rand 1000]
set string to a number between 1 and 1000
Elen sila lúmenn' omentielvo
e
egghead
Master
Posts: 481
Joined: Mon Oct 29, 2001 8:00 pm
Contact:

Post by egghead »

Papillon wrote:

Code: Select all

set string [rand 1000]
set string to a number between 1 and 1000
rand <limit>
returns: a random integer between 0 and limit-1
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Post by Papillon »

ooops :oops:
I knew it was - or + 1 somewhere in there ..... didn't have the time check which it was... guess I picked the wrong one :-?
Elen sila lúmenn' omentielvo
Locked