• Create Account

### #Actualselve

Posted 21 November 2012 - 01:14 PM

balltarget.x = (rand() * 100) % SCREEN_WIDTH;

That code basically picks a random column that is a multiple of the greatest common divisor of 100 and SCREEN_WIDTH. Are you sure that's what you want?

So if I want a normal random not multiplied should I do this:

[source lang="cpp"]balltarget.x = ( (rand() * 100) % SCREEN_WIDTH) / 2;[/source]

### #1selve

Posted 21 November 2012 - 01:14 PM

balltarget.x = (rand() * 100) % SCREEN_WIDTH;

That code basically picks a random column that is a multiple of the greatest common divisor of 100 and SCREEN_WIDTH. Are you sure that's what you want?

So if I want a normal random not multiplied should I do this:

[source lang="cpp"]balltarget.x = ( (rand() * 100) % SCREEN_WIDTH) / 2;[/source]

PARTNERS