Getting a random event to use as seed. - Unix

This is a discussion on Getting a random event to use as seed. - Unix ; I'm trying to get a random seed for srand function, but it seems like I can't use the time as seed, since the only function available among the libraries that allows this is ctime, and when I use it inside ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: Getting a random event to use as seed.

  1. Getting a random event to use as seed.

    I'm trying to get a random seed for srand function, but it seems like
    I can't use the time as seed, since the only function available among
    the libraries that allows this is ctime, and when I use it inside my
    code I pass from 39Kb of binary to 52Kb or so.. This size exceeds my
    available memory... is there any other way to get a random seed?
    Or, maybe, is there a way to tell the compiler to just use the ctime
    function and forget about all the rest of the library?
    I'm programming on a C5471 Texas Instruments DSP.. and I don't see any
    other way of getting a genuine random event as seed... I mean...
    everything is not really random, but the time you start running the
    code...
    Thanks in advance & Cheers
    RM

  2. Re: Getting a random event to use as seed.

    On May 27, 6:10*am, InuY4sha wrote:

    > I'm trying to get a random seed for srand function, but it seems like
    > I can't use the time as seed, since the only function available among
    > the libraries that allows this is ctime, and when I use it inside my
    > code I pass from 39Kb of binary to 52Kb or so.. This size exceeds my
    > available memory... is there any other way to get a random seed?
    > Or, maybe, is there a way to tell the compiler to just use the ctime
    > function and forget about all the rest of the library?
    > I'm programming on a C5471 Texas Instruments DSP.. and I don't see any
    > other way of getting a genuine random event as seed... I mean...
    > everything is not really random, but the time you start running the
    > code...


    What hardware do you have? Surely you have something that you can get
    some randomness from. If you have, for example, an A-to-D converter,
    you count the number of consecutive samples with the last significant
    bit set, followed by the number with it cleared, followed by the
    number with it set, and use those numbers to form a seed. (Possibly
    with a multiply, count bits, add, repeat algorithm.)

    DS

  3. Re: Getting a random event to use as seed.

    InuY4sha writes:
    > I'm trying to get a random seed for srand function, but it seems like
    > I can't use the time as seed, since the only function available among
    > the libraries that allows this is ctime, and when I use it inside my
    > code I pass from 39Kb of binary to 52Kb or so.. This size exceeds my
    > available memory... is there any other way to get a random seed?
    > Or, maybe, is there a way to tell the compiler to just use the ctime
    > function and forget about all the rest of the library?
    > I'm programming on a C5471 Texas Instruments DSP.. and I don't see any
    > other way of getting a genuine random event as seed... I mean...
    > everything is not really random, but the time you start running the
    > code...


    Does your C5471 Texas Instruments DSP run Unix? If not, why ask here?

    --
    Keith Thompson (The_Other_Keith) kst-u@mib.org
    Nokia
    "We must do something. This is something. Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"

+ Reply to Thread