Search the web
Sign In
New User? Sign Up
beginnersroguelikedevelopment · Beginners Roguelike Development - A place for discussing game development issues
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Want your group to be featured on the Yahoo! Groups website? Add a group photo to Flickr.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
need help with a RNG   Message List  
Reply | Forward Message #198 of 567 |
Hi im kinda getting back into the c++ scene after about a 3 year
period away from it and would appreciate some input on how to as
easily as possible impliment random number generation in c++. Please
note i havent coded in a long period of time and may need to have
things explained in a almost Dr. Suess way.





Wed Sep 14, 2005 3:07 pm

omf_omf
Online Now Online Now
Send Email Send Email

Forward
Message #198 of 567 |
Expand Messages Author Sort by Date

Hi im kinda getting back into the c++ scene after about a 3 year period away from it and would appreciate some input on how to as easily as possible impliment...
Reece
omf_omf
Online Now Send Email
Sep 14, 2005
3:08 pm

... number=rand()%6+1; //dice(1-6)...
puma_htp
Offline Send Email
Sep 14, 2005
8:30 pm

Unfortunately, that method only works if you need a number between 0 and n. I have a somewhat strange but effective method for generating random numbers (you...
gamer_2k4
Offline Send Email
Sep 15, 2005
12:43 am

I think you'd be better off just call srand() occasionally (or just once when your code starts). I tend to just call "srand(time(NULL))" near my program entry...
allan175uk
Offline Send Email
Oct 1, 2005
10:12 pm

I use the random number generator for map creation, so if I want a 1 in 3 chance that a tree will be generated on a tile (instead of just grass) and I have a...
gamer_2k4
Offline Send Email
Oct 4, 2005
2:13 am

You'll still get a 1-in-3 chance of getting a tree just by using rand(). There are obviously better random number generators around which you could use, ones...
allan
allan175uk
Offline Send Email
Oct 4, 2005
8:08 am

... 1 ... just ... If your concern is the speed of the RNG you could always process your data in chunks (pseudocode follows): int x; char map[64][100]; while...
David
fthnature
Offline Send Email
Oct 4, 2005
8:36 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help