[TF] Rand()
Brought to you by:
kenkeys
|
From: naked at iki.fi (N. Kotivuori) - 2003-02-09 15:03:55
|
Drake Wilson wrote:
> Quoth James West <ja...@ze...>, on Sun 09 Feb 2003:
>> I'm trying to assign the result of rand() to a variable and failing
>> horribly, I assumed that:
>>
>> /def getrandom = /let var1=rand(0,9)%;/echo %(var1}
>
> This sets var1 to the string "rand(0,9)". To evaluate it as an
> expression, you need to put $[...] around it, like so:
>
> /def getrandom =/let var1=$[rand(0,9)]%;/echo %{var1}
Ofcourse,
/def getrandom = /result rand(0,9)
Might be a little easier.
-- Naked
|