Where is wrong?
#6

That doesn't look very correct though. Even if it does work, it will not be a true randomized float (it will not be precise).

If you want a real random float you can do that by calculating a random integer between 0 and 1000, convert that number to float and divide it by 1000.0. You'll have a float from 0.0 to 0.999 and can use this as factor for the range you want to randomize.

For example, if you want a random float ranging from 0.0 to a given number (like random(), just as float):

Код:
forward Float:floatrandom(Float:val);
Float:floatrandom(Float:val)
{
return float(random(1000)) / 1000.0 * val;
}
Then you can use this function to calculate a true random float.
Reply


Messages In This Thread
Where is wrong? - by 3417512908 - 12.06.2018, 10:31
Re: Where is wrong? - by Calisthenics - 12.06.2018, 10:40
Re: Where is wrong? - by Dayrion - 12.06.2018, 10:44
Re: Where is wrong? - by 3417512908 - 12.06.2018, 10:49
Re: Where is wrong? - by poppingrose - 12.06.2018, 14:14
Re: Where is wrong? - by NaS - 12.06.2018, 14:54
Re: Where is wrong? - by Ada32 - 12.06.2018, 15:53

Forum Jump:


Users browsing this thread: 1 Guest(s)