From: Tom Rini <trini@konsulko.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [U-Boot, v2] tools: gen_eth_addr: add getpid() to time(0) to avoid duplicated seed
Date: Mon, 28 Sep 2015 17:08:36 -0400 [thread overview]
Message-ID: <20150928210836.GC22966@bill-the-cat> (raw)
In-Reply-To: <1442398864-1312-1-git-send-email-josh.wu@atmel.com>
On Wed, Sep 16, 2015 at 06:21:04PM +0800, Josh Wu wrote:
> As 'time(0) | getpid()' will have a lot of duplicated value. It is not a
> expected behavior. We expect different value for the seed when when run
> it in many times.
>
> So this patch will left shift the getpid() and add to time(0). That
> avoid duplicated value.
>
> Test command is like:
> % RUN=0; while [ $RUN -lt 10000 ]; do
> tools/gen_eth_addr; RUN=$(($RUN+1)); done | sort | uniq | wc -l
> 10000
>
> This patch is incorporated with suggestions made by Wolfgang Denk and Andreas
> Bie?mann. Thanks them a lot.
>
> Signed-off-by: Josh Wu <josh.wu@atmel.com>
> Acked-by: Andreas Bie?mann <andreas.devel@googlemail.com>
> Acked-by: Wolfgang Denk <wd@denx.de>
> Tested-by: Wolfgang Denk <wd@denx.de>
Applied to u-boot/master, thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150928/71531e23/attachment.sig>
prev parent reply other threads:[~2015-09-28 21:08 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-16 10:21 [U-Boot] [PATCH v2] tools: gen_eth_addr: add getpid() to time(0) to avoid duplicated seed Josh Wu
2015-09-16 10:29 ` Andreas Bießmann
2015-09-16 12:56 ` Wolfgang Denk
2015-09-28 21:08 ` Tom Rini [this message]
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=20150928210836.GC22966@bill-the-cat \
--to=trini@konsulko.com \
--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.