Programming Forums
User Name Password Register
 

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

Reply
 
Thread Tools Display Modes
Old Jan 3rd, 2006, 9:03 AM   #11
cairo
Newbie
 
Join Date: Dec 2005
Posts: 18
Rep Power: 0 cairo is on a distinguished road
oppsss....
sorry , i forget to put in code tag

@InfoGeek, im not really get it ......
any website or detail explanation for me ?

thanks guys, i already solved it
cairo is offline   Reply With Quote
Old Jan 3rd, 2006, 9:11 AM   #12
cairo
Newbie
 
Join Date: Dec 2005
Posts: 18
Rep Power: 0 cairo is on a distinguished road
Don't ever use time() to initialize srand() ?
have a look
http://csl.sublevel3.org/c++/
cairo is offline   Reply With Quote
Old Jan 3rd, 2006, 9:29 AM   #13
nnxion
Programming Guru
 
nnxion's Avatar
 
Join Date: Jun 2005
Location: elemental plane
Posts: 1,429
Rep Power: 5 nnxion is on a distinguished road
Quote:
Originally Posted by cairo
Don't ever use time() to initialize srand() ?
have a look
http://csl.sublevel3.org/c++/
Did you read why?
Quote:
# Summary: Using time() to initialize srand() will set the same seed for all processes launched within the same second. For a lot of real-world appliations, and especially server programming, launching several processes withing the same second is quite common. Use another mechanism instead, such as gettimeofday(), which has microsecond precision.
In the future gettimeofday() might not even be fast enough, there are plenty of examples out there that will get you "truly random" numbers.
__________________
"Employ your time in improving yourself by other men's writings, so that you shall gain easily what others have labored hard for."
-- Socrates
nnxion 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 8:40 PM.

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