in reply to srand producing the same sequence of random numbers

if you're not after a repeatable set, seed it every time with timer value. that's pretty close to something resembling a random set of numbers.
btw there's only ever a theoretically possible set of true random numbers, and nothing like it in programming or life/nature. and the harder mathematicians and/or programmers strive to get to truly random number sets, the more they approach a truly contrived/artificial set.
just a matter of how random you want your set of numbers to appear. seeding with timer seconds or milliseconds value works for me on most occasions.
the hardest line to type correctly is: stty erase ^H
  • Comment on Re: srand producing the same sequence of random numbers

Replies are listed 'Best First'.
Re^2: srand producing the same sequence of random numbers
by CountZero (Bishop) on Oct 12, 2010 at 06:18 UTC
    It is a philosophical question whether any true randomness exists. Even at the quantum level there is some debate (see Einstein's famous quote "I, at any rate, am convinced that He does not throw dice.").

    Anyhow, to get some real life random (in the sense of unpredictable at the present state of science) figures, see http://www.random.org/

    CountZero

    A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

      It is a philosophical question whether any true randomness exists. Even at the quantum level there is some debate

      There is some debate, but the overwhelming majority of the scientific community has accepted that there is true randomness.

      (see Einstein's famous quote "I, at any rate, am convinced that He does not throw dice.")

      Smart as he was, Einstein didn't offer any other explanation for things that quantum mechanics explains.

      I think his rejection was based on the old mechanistic view of the world, which assumed that given enough information and the correct formulas, it is possible to exactly predict everything.

      There is a saying that major scientific theories don't get accepted by convincing the opponents, but that the opponents die out in the end. That's what happened here too.

      Perl 6 - links to (nearly) everything that is Perl 6.
        At any rate even untrue randomness at the quantum level will be practically impossible to discern from true randomness, I guess.

        CountZero

        A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James