[SOLVED] Random
#7

Quote:
Originally Posted by mansonh
random returns a float, in your case between 0 an 1.
However you are turning it into an int which means you will always get 0.
So you need to do
new rand = floatround(random(sizeof(TEAMS)), floatround_floor);

You use floatround_floor because sizeof(teams) will be 2, and you want 0 or 1.
sizeof isn't a float.
Reply


Messages In This Thread
[SOLVED] Random - by Rzzr - 23.01.2010, 19:24
Re: [NOT SOLVED] Random - by Rzzr - 24.01.2010, 12:46
Re: [NOT SOLVED] Random - by *ToM* - 24.01.2010, 12:49
Re: [NOT SOLVED] Random - by Rzzr - 24.01.2010, 12:50
Re: [NOT SOLVED] Random - by MadeMan - 24.01.2010, 13:29
Re: [NOT SOLVED] Random - by mansonh - 24.01.2010, 13:34
Re: [NOT SOLVED] Random - by MadeMan - 24.01.2010, 13:37
Re: [NOT SOLVED] Random - by mansonh - 24.01.2010, 13:38
Re: [NOT SOLVED] Random - by dice7 - 24.01.2010, 13:41
Re: [NOT SOLVED] Random - by Rzzr - 24.01.2010, 13:46

Forum Jump:


Users browsing this thread: 4 Guest(s)