egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

different [rand values] (SOLVED)

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
Torrevado
Op


Joined: 02 Aug 2006
Posts: 101

PostPosted: Sun Aug 22, 2010 11:52 am    Post subject: different [rand values] (SOLVED) Reply with quote

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
View user's profile Send private message
willyw
Revered One


Joined: 15 Jan 2009
Posts: 1175

PostPosted: Sun Aug 22, 2010 12:26 pm    Post subject: Re: different [rand values] Reply with quote

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
View user's profile Send private message
Torrevado
Op


Joined: 02 Aug 2006
Posts: 101

PostPosted: Sun Aug 22, 2010 1:44 pm    Post subject: Reply with quote

Yeah, that is.
Thank you very much Wink
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber