Notices
Results 1 to 2 of 2

Thread: How do i get a quick RNG that gives different results every (at least) 1/60secponds?

  1. #1 How do i get a quick RNG that gives different results every (at least) 1/60secponds? 
    Forum Ph.D.
    Join Date
    Jan 2013
    Posts
    920
    should i use srand() with a different seed other than time(NULL)?

    or is there a method?

    i tried Scipio's method from
    Urgent: Generating random numbers WITHOU - C++ Forum

    and i got the same results.

    anyway, im making an object vibrate in opengl for that matter.
    the rand() im using in domainloop gives a random change in number every ~1second.

    i need one that refreshes faster. help is appreciated!


    Quote Originally Posted by jocular View Post
    If thy right nipple offend thee, pluck it off! Goes for the other, too!
    Reply With Quote  
     

  2.  
     

  3. #2  
    Forum Radioactive Isotope MagiMaster's Avatar
    Join Date
    Jul 2006
    Posts
    3,440
    Don't reseed. You just seed the generator once at the beginning of your program. time(NULL) gives an answer in seconds, and if you reseed with the same seed, you get the same results in the following calls to rand() (which is the entire point of a seed).

    BTW, Scipio's code is a way of getting a random permutation of a set of numbers, and depending on how many of those numbers you need, there are faster ways. But that's not the same thing as getting a string of random numbers. (You'll almost never get a pair which you should if it were actually random.)


    Reply With Quote  
     

Similar Threads

  1. CBC Results
    By jocular in forum Health & Medicine
    Replies: 20
    Last Post: September 3rd, 2013, 12:57 AM
  2. First experiments and results of CERN
    By dapifo in forum Physics
    Replies: 23
    Last Post: June 27th, 2012, 12:17 PM
  3. Quick Bin Laden DNA results?
    By WVBIG in forum Criminology and Forensic Science
    Replies: 6
    Last Post: July 4th, 2011, 10:23 PM
  4. the limitations of mathematical results
    By theQuestIsNotOver in forum Mathematics
    Replies: 60
    Last Post: January 30th, 2011, 03:25 AM
  5. Results On Experiment
    By shaunyp in forum Chemistry
    Replies: 2
    Last Post: October 17th, 2010, 06:59 AM
Bookmarks
Bookmarks
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •