| View previous topic :: View next topic |
| Author |
Message |
Torrevado Op
Joined: 02 Aug 2006 Posts: 101
|
Posted: Sun Aug 22, 2010 11:52 am Post subject: different [rand values] (SOLVED) |
|
|
Hello,
I'd like to know how to get two different random values. Value 1 + Value 2 *must* be = 100
I tried
| Code: | set value1 [rand 100]
set value2 [rand 100] |
Obviously doing addition of both values, the result can be less than 100 or upto 200.
Last edited by Torrevado on Sun Aug 22, 2010 1:46 pm; edited 1 time in total |
|
| Back to top |
|
 |
willyw Revered One
Joined: 15 Jan 2009 Posts: 1175
|
Posted: Sun Aug 22, 2010 12:26 pm Post subject: Re: different [rand values] |
|
|
| Torrevado wrote: | Hello,
I'd like to know how to get two different random values. Value 1 + Value 2 *must* be = 100
I tried
| Code: | set value1 [rand 100]
set value2 [rand 100] |
Obviously doing addition of both values, the result can be less than 100 or upto 200. |
How about :
| Code: |
set value2 [expr 100 - $value1]
|
|
|
| Back to top |
|
 |
Torrevado Op
Joined: 02 Aug 2006 Posts: 101
|
Posted: Sun Aug 22, 2010 1:44 pm Post subject: |
|
|
Yeah, that is.
Thank you very much  |
|
| Back to top |
|
 |
|