|
Joined: Jan 2003
Posts: 14
Pikka bird
|
OP
Pikka bird
Joined: Jan 2003
Posts: 14 |
hi.. am wondering.. is it possible to have a random number generator that will spit out a number from 1-10 .. like
3.256 <--
on a command like : !capture it will say $nick was captured in 9.653
any help would be apprectiated greatly !!!
|
|
|
|
Joined: Jan 2003
Posts: 3,012
Hoopy frood
|
Hoopy frood
Joined: Jan 2003
Posts: 3,012 |
alias randDec {
/set -u0 %num $rand(1,10)
return $+(%num,.,$iif(%num < 10, $+($rand(0,9),$rand(0,9),$rand(0,9)),000))
}
-KingTomato
|
|
|
|
Joined: Jan 2003
Posts: 14
Pikka bird
|
OP
Pikka bird
Joined: Jan 2003
Posts: 14 |
that is working !! except.. am always getting an even number..
like 7.000 or 9.000 will it always do that ? or will it come up with also a 7.235 etc ?
thank you also !!
|
|
|
|
Joined: Jan 2003
Posts: 2,523
Hoopy frood
|
Hoopy frood
Joined: Jan 2003
Posts: 2,523 |
alias randdec return $calc($rand($calc($1 *10^ $3),$calc($2 *10^ $3)) /10^ $3) Usage: $randdec(N1,N2,P) N1 and N2 are the same parameters as in $rand() P is the precision parameter. Fex, to create random numbers from 2 to 13 with up to 4 decimals you'd use this: $randdec(2,13,4)
/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
|
|
|
|
Joined: Jan 2003
Posts: 14
Pikka bird
|
OP
Pikka bird
Joined: Jan 2003
Posts: 14 |
hii..
am not able to get that last script to work at all for some reason.. thank you for your help though..
|
|
|
|
Joined: Jan 2003
Posts: 3,012
Hoopy frood
|
Hoopy frood
Joined: Jan 2003
Posts: 3,012 |
10-try test using mine...
4.368 7.885 3.851 5.317 4.179 5.179 4.951 8.862 3.822 5.633
-KingTomato
|
|
|
|
Joined: Jan 2003
Posts: 14
Pikka bird
|
OP
Pikka bird
Joined: Jan 2003
Posts: 14 |
am not quite sure how to set it up though..
|
|
|
|
Joined: Jan 2003
Posts: 14
Pikka bird
|
OP
Pikka bird
Joined: Jan 2003
Posts: 14 |
that is exactly what i want though .. number wise !!!!
|
|
|
|
Joined: Jan 2003
Posts: 3,012
Hoopy frood
|
Hoopy frood
Joined: Jan 2003
Posts: 3,012 |
Just put this in remotes:
alias randDec { /set -u0 %num $rand(1,10) return $+(%num,.,$iif(%num < 10, $+($rand(0,9),$rand(0,9),$rand(0,9)),000)) }
-KingTomato
|
|
|
|
Joined: Dec 2002
Posts: 2,809
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,809 |
That script is incredibly complex for such a simple task. There is no need for any $iifs, no local variables,
$calc(($rand(1,100000000)/$rand(1,1000000) % 9) +1)
That will return a random real number between 1 and 10. If you want it to only have 3 decimal places, use $round:
$round($calc(($rand(1,100000000)/$rand(1,1000000) % 9) + 1),3)
It produces some very nice random results: 7.61 7.052 9.145 9.382 6.79 3.115 1.546 5.04 8.57 7.766
|
|
|
|
Joined: Jan 2003
Posts: 14
Pikka bird
|
OP
Pikka bird
Joined: Jan 2003
Posts: 14 |
thank you so much !!!!!!!!!! i was so tired last night i went and stuck it in the alias *lol*
BUT now.. it works !!
|
|
|
|
Joined: Jan 2003
Posts: 3,012
Hoopy frood
|
Hoopy frood
Joined: Jan 2003
Posts: 3,012 |
Always good to hear.
-KingTomato
|
|
|
|
|