Results 1 to 2 of 2

Thread: I need some randomness

  1. #1
    NOMADMAN
    Guest

    I need some randomness

    if I use srand(time(NULL)) in my initialize portion of my project (OGL, by the way), and then use rand() blah blah blah to get random colors on some QUADS I'm using they turn out the same color everytime. It like I'm seeding the generator with the same number each time. I thought time(NULL) would be the time past midnight in millis. Am I wrong?

    Thanks, NOMAD

  2. #2
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    no, time() is the seconds since
    00-00-1970 00:00:00


    only seed the generator once: call srand at the start of your app and never again
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width