Jump to content
  • Advertisement

Archived

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

TechnoGoth

Random Number Difficulty

This topic is 5242 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''m having problems generating a good random values for the skill stats in a game I''m working on. There are 6 skill stats that can range from 0 to 10, and I want to generate a random value for those stats when generating a character. The problem is I want the numbers to relativitly low. I guess basiclly what I''m looking for is help coming up with an alorgithim that will do the following: 1)Generate skill points. 2)As it generates skill points decrease the likely hood of generating another skill point. 3)Assign skill points, with prefrence based on how many points a skill currently has. Any advice? ----------------------------------------------------- "Fate and Destiny only give you the opportunity the rest you have to do on your own." Current Design project: Ambitions Slave

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
I would generate 6 random floats ranging from 0..1.. this can be thought of as a 6-dimensional vector.

Normalize this vector so that the length equals 1.

Then assign skill points by multiplying the respective scalar value by N, the total number of skill points you want him to recieve.

You can play with the distribution of the original floats. If you want a more balanced skill spread, sqrt() the random floats. If you want a less balanced skill spread, sqr() the random floats.

Share this post


Link to post
Share on other sites
Get all the probabilities of a given skill being chosen.
for x = 0 to 10
tprob = tprob + skill(x, y)
next x
j = int(rnd() * tprob)
for x = 0 to 10
if j > (skill(x, y) + t) then
skill(x) = snum(x, y)
exit for
end if
next x

This should help
DENC

Share this post


Link to post
Share on other sites

  • 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!