Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Apr 13th, 2006, 12:20 AM   #11
Writlaus
Hobbyist Programmer
 
Writlaus's Avatar
 
Join Date: Nov 2005
Posts: 149
Rep Power: 3 Writlaus is on a distinguished road
Well, as I can remember, when I had set the seed and used the rand() function directly after that, it would always return very similar integers, no matter how many times I ran the program. I might be mistaken, but the problem only seemed to go away after I called rand() a bunch of times.
Writlaus is offline   Reply With Quote
Old Apr 13th, 2006, 5:25 AM   #12
grumpy
Programming Guru
 
grumpy's Avatar
 
Join Date: Jun 2005
Location: Adelaide, South Australia
Posts: 1,223
Rep Power: 5 grumpy is on a distinguished road
Quote:
Originally Posted by Writlaus
Well, as I can remember, when I had set the seed and used the rand() function directly after that, it would always return very similar integers, no matter how many times I ran the program. I might be mistaken, but the problem only seemed to go away after I called rand() a bunch of times.
If you used the same seed every time, you would have gotten the same sequence of numbers from rand(). The only way to change the sequence is to change the seed every time you run the program. Calling rand() a few times would have changed the position in that sequence where your program started using the sequence (i.e. it would have just ignored the first 10, but the ones after that would have been identical every time you ranyour program unless you changed the seed).
grumpy is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 10:26 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC