Random float.
#5

pawn Код:
new n1 = random(3); //or whatever should be the max value infront of the .
new n2;
if(n1 == 0)
    n2 = random(50) + 50;
else if(n1 == 2)
    n2 = random(16);
else
    n2 = random(100);
new string[50];
format(string, sizeof(string), "%d.%d", n1, n2);
new Float:randomfloat = floatstr(string);
something like that (not tested)

or that
Quote:
Originally Posted by HazardouS
Посмотреть сообщение
Get a random number between 50 and 215 and divide it by 100, making sure that the result will be a float (result = random / 100.0; )
Reply


Messages In This Thread
Random float. - by Baltimore - 08.02.2015, 15:17
Re: Random float. - by Sascha - 08.02.2015, 15:19
Re : Re: Random float. - by Baltimore - 08.02.2015, 15:24
Re: Random float. - by HazardouS - 08.02.2015, 15:26
Re: Random float. - by Sascha - 08.02.2015, 15:29
Re: Random float. - by vinigas - 08.02.2015, 15:30

Forum Jump:


Users browsing this thread: 3 Guest(s)