All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Walle <michael@walle.cc>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v4 1/3] lib: add rand() function
Date: Fri, 11 May 2012 23:20:15 +0200	[thread overview]
Message-ID: <201205112320.15462.michael@walle.cc> (raw)
In-Reply-To: <20120511211132.32130206496@gemini.denx.de>


> please keep the ML on Cc: - thanks.
sorry wrong key

> In message <201205112249.27871.michael@walle.cc> you wrote:
> > > > > > +static unsigned int y = 2463534242U;
> > > > > 
> > > > > Hm... can we introduce at least a little entropy somewhere?
> > > > 
> > > > Mh? A user is supposed to seed via srand().
> > > 
> > > Then why initialize y at all?
> > 
> > To have a sane fallback. Maybe i should have written
> > 
> >  "A user is supposed to seed via srand() if he wan't some
> > 
> > entropy."
> 
> This is inconsequent.  Either we assume that the user will seed
> srand(), then y should not be initialized at all, so it goes to the
> BSS segment and does not waste space in the binary image.  Or we want
> to deal with cases where the user doesn call srand(), and then we
> should provide a bit better than such a static initialization.

Again, i wanted to stick with the regular rand() srand() semantics.

http://pubs.opengroup.org/onlinepubs/009695399/functions/rand.html
"If rand() is called before any calls to srand() are made, the same sequence 
shall be generated as when srand() is first called with a seed value of 1."

But i'm fine with removing the initialization.

-- 
Michael

  reply	other threads:[~2012-05-11 21:20 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-10 17:32 [U-Boot] [PATCH v4 0/3] net: helper functions Michael Walle
2012-05-10 17:32 ` [U-Boot] [PATCH v4 1/3] lib: add rand() function Michael Walle
2012-05-11 19:20   ` Wolfgang Denk
2012-05-11 20:32     ` Michael Walle
2012-05-11 20:43       ` Wolfgang Denk
     [not found]         ` <201205112249.27871.michael@walle.cc>
2012-05-11 21:11           ` Wolfgang Denk
2012-05-11 21:20             ` Michael Walle [this message]
2012-05-11 21:29               ` Wolfgang Denk
2012-05-11 21:34                 ` Michael Walle
2012-05-10 17:32 ` [U-Boot] [PATCH v4 2/3] net: add helper to generate random mac address Michael Walle
2012-05-11 19:21   ` Wolfgang Denk
2012-05-14  5:43     ` Mike Frysinger
2012-05-10 17:32 ` [U-Boot] [PATCH v4 3/3] net: add eth_setenv_enetaddr_by_index() Michael Walle
2012-05-11 19:25   ` Wolfgang Denk
2012-05-11 21:01     ` Michael Walle
2012-05-11 21:16       ` Wolfgang Denk
2012-05-11 22:12         ` Michael Walle
2012-05-11 16:32 ` [U-Boot] [PATCH v4 0/3] net: helper functions Michael Walle
2012-05-11 16:46   ` Joe Hershberger
2012-05-11 16:51     ` Prafulla Wadaskar
2012-05-21 20:52       ` Michael Walle
2012-05-11 19:18 ` Wolfgang Denk
2012-05-11 20:29   ` Michael Walle
2012-05-11 20:43     ` Wolfgang Denk
2012-05-11 20:54       ` Michael Walle
2012-05-11 21:14         ` Wolfgang Denk
2012-05-11 21:22           ` Michael Walle
2012-05-11 21:30             ` Wolfgang Denk
2012-05-11 21:42               ` Michael Walle
2012-05-11 21:55                 ` Wolfgang Denk
2012-05-14  5:42             ` Mike Frysinger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201205112320.15462.michael@walle.cc \
    --to=michael@walle.cc \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.