Forums | developer.brewmp.com Forums | developer.brewmp.com

Developer

Forums

Forums:

Hi all,

I am finding problem understanding exactly what GETRAND() does?

Can anyone clarify wat it does and in what context is it used?

diya007 wrote:Hi all,
I am finding problem understanding exactly what GETRAND() does?
Can anyone clarify wat it does and in what context is it used?
getrand return a random value. Exemple:
uint32 getRandomValue()
{
uint32 ret;
GETRAND(&ret, sizeof(uint32));
//in ret you now have the random value
return ret;

what do you need it for ? For example you create a game and you want random enemies to generate on the screen sometimes between 2 and 7 seconds one from another.
So....the time will be = 2 + ABS( ( getRandomValue() )% ( 7 - 2 ) );
where abs means absolute value( a >= 0 ? a:-a );

diya007 wrote:Hi all,
I am finding problem understanding exactly what GETRAND() does?
Can anyone clarify wat it does and in what context is it used?
getrand return a random value. Exemple:
uint32 getRandomValue()
{
uint32 ret;
GETRAND(&ret, sizeof(uint32));
//in ret you now have the random value
return ret;

what do you need it for ? For example you create a game and you want random enemies to generate on the screen sometimes between 2 and 7 seconds one from another.
So....the time will be = 2 + ABS( ( getRandomValue() )% ( 7 - 2 ) );
where abs means absolute value( a >= 0 ? a:-a );