Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

ostamo1

fixed::::rolling 4d6

This topic is 5224 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

i am using random.h and random.cpp from tis mersenne twister class and i woul like to know hot to roll 4 six sided dice and remove the lowest value and return the result http://www.codeproject.com/cpp/mersennetwisterclass.asp i tried to use the example one in the stats.ccfile.hosted on trollforge.sourceforge.net which is here but it always returns a number higher than 40
int gen_ability()
{
  // Roll 4d6, drop the lowest die.


  static const int NUM_DICE = 4;
  static const int NUM_SIDES = 6;

  int dice[ NUM_DICE ];

  int lowest = 1000;
  int total = 0;

  for(int i = 0; i < NUM_DICE; ++i) {
 dice[i] = roll( NUM_SIDES );//changed roll to rolldice(6,4)


	 total += dice[i];

	 if ( dice[i] < lowest)
		lowest = dice[i];
  }

  return total - lowest;
}
[\source]
[edited by - ostamo1 on June 2, 2004 2:16:58 AM]

Share this post


Link to post
Share on other sites
Advertisement

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!