Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


#Actualill

Posted 23 March 2013 - 03:49 PM

//why not use random integer code instead of using the random float code to generate a random integer?!?!
int roll = (int) floor(glm::linearRand(1.0f, 7.0f) + 0.5f);

//why not say someValue = roll - 1
if (roll == 1)
	someValue = 0;
else if (roll == 2)
	someValue = 1;
else if (roll == 3)
	someValue = 2;
else if (roll == 4)
	someValue = 3;
else if (roll == 5)
	someValue = 4;
else if(roll == 6)
	someValue = 5;
else if(roll == 7)
	someValue = 6;
else
	someValue = 0;

The things I have to deal with sometimes...


#1ill

Posted 23 March 2013 - 03:48 PM

//why not use random integer code instead of using the random float code to generate a random integer?!?!
int roll = (int) floor(glm::linearRand(1.0f, 7.0f) + 0.5f);

//why not say someValue = roll - 1
if (roll == 1)
	someValue = 0;
else if (roll == 2)
	someValue = 1;
else if (roll == 3)
	someValue = 2;
else if (roll == 4)
	someValue = 3;
else if (roll == 5)
	someValue = 4;
else if(roll == 6)
	someValue = 5;
else if(roll == 7)
	someValue = 6;
else
	someValue = 0;

PARTNERS