View previous topic :: View next topic |
Author |
Message |
simo Owner
Joined: 22 Mar 2015 Posts: 969
|
Posted: Thu Sep 22, 2022 7:54 am Post subject: A proc that generates random digits |
|
|
greetz gentz,
i wanted to use random digits in range or specific digits to use in certain other tcls
for example:
or
and so on |
|
Back to top |
|
 |
CrazyCat Revered One

Joined: 13 Jan 2002 Posts: 1057 Location: France
|
Posted: Thu Sep 22, 2022 8:30 am Post subject: |
|
|
I don't really understand what you're asking for.
If you want a number between 100 and 250:
Code: | set min 100
set max 100
set myrand [expr {$min + round(rand()*($max-$min))}] |
If you want a random number from a list:
Code: | set items {10 25 50 75 100}
set myrand [lindex $items [rand [llength $items]]] |
_________________ https://www.eggdrop.fr - French IRC network
Offer me a coffee - Do not ask me help in PM, we are a community. |
|
Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 969
|
Posted: Thu Sep 22, 2022 8:42 am Post subject: |
|
|
thanks CrazyCat |
|
Back to top |
|
 |
|