This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: -- time access
- From: Andrew Lunn <andrew at lunn dot ch>
- To: Aravind B <arvindb at cranessoftware dot com>
- Cc: ecos-discuss at sources dot redhat dot com
- Date: Thu, 5 Feb 2004 23:44:19 +0100
- Subject: Re: [ECOS] -- time access
- References: <1075970871.3759.6.camel@ambica>
On Thu, Feb 05, 2004 at 02:17:48PM +0530, Aravind B wrote:
> hi,
> i want to generate a random number for which i am using system time
> value to updata seed value. but it is not working with sid.
> is there any solution for these
> if so please send me the solution.
Generating random numbers is difficult in embedded systems. The system
time is not random. You program will always take the same amount of
time for it to reach the call to read the time. So this is in fact a
constant. So you are seeding the random number generator with a
constant.
You need something external for the seed. The time between two
ethernet packets, the time you receive something from the serial port
etc.
Andrew
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss