A function like random/randomex(), but for floats.
#1

I'm looking a random function for floats:
fRandom(230.4, 530.7);

Have anyone created a function like this?

I have this function, but it shows error. ((error in the comment)
pawn Код:
stock Float:fRandomEx(Float:min, Float:max) // function with tag result used before definition, forcing reparse
{
    return min+(max - min)*random(32768)/32768.0;
}
Reply
#2

Why not convert the float to an integer first? https://sampwiki.blast.hk/wiki/Floatround
Reply
#3

Quote:
Originally Posted by playbox12
Посмотреть сообщение
Why not convert the float to an integer first? https://sampwiki.blast.hk/wiki/Floatround
Oh, yeah. Didn't think of that, thanks.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)