Jump to content
  • Advertisement
Sign in to follow this  
  • entries
    152
  • comments
    85
  • views
    99549

Randomization

Sign in to follow this  
DecipherOne

112 views

Well, I've finally gotten some time in working on C.F.L. a bit more today. There really is a hell of a lot to do. At any rate, I have a selection structure for a trivia element with 500 questions listed in it ranging through about ten different categories.

I spent about an hour or so looking into better pseudo-random number generation today. My main source was Mathmatical Techniques from the Infinite Game Universe series by Guy W. Lecky - Thompson. Although he goes over two algorithms and seeding, which I've had an understanding of for sometime, I couldn't really find any useful information. Aside from creating various switch statements that use various ranges of numbers to come up with a random total, I can't seem to come up with a good approach to finding an algorithm that works very well at all. Everytime I run through that segment of the game, it seems that the results tend to be more in the first one hundred questions then anywhere else, this is probably about eighty percent or more of the time. I suppose I'm wondering if anyone out there has a solution to better randomization of numbers, or can point me in the right direction. Thanks in advance if you can help, if not :p.


EDIT: I suppose I should say that I am using the rand() function with srand based on time, actually here is the code. What the F@# I just realized what the problem has been all this time, I only have a total of one hundred instead of five hundred in my random number generation. That explains a lot. DOH!
Sign in to follow this  


2 Comments


Recommended Comments

In Code Complete 2nd Edition, there's a useful random number class in there, you should check it out.

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • 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!