How can I make random with 'real' numbers?
#2

The native random doesn't accept floats. You just mindfucked me, but I figured it out, anyway I scripted this, and it worked like a charm
Код:
stock Float:RandomEx(Float:max)
{
new Float:range = max;
new Float:num = range * random(32767)/32767;
return num;
}
And if you want minimum value param, try this:
Код:
stock Float:RandomEx(Float:min,Float:max)
{
new Float:range = max-min;
new Float:num = min+range * random(32767)/32767;
return num;
}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)