zsh-workers
 help / color / mirror / code / Atom feed
* $RANDOM initial state doesn't change
@ 2015-02-23 20:22 Timo Sirainen
  2015-02-23 23:27 ` Jan Larres
  0 siblings, 1 reply; 3+ messages in thread
From: Timo Sirainen @ 2015-02-23 20:22 UTC (permalink / raw)
  To: zsh-workers

I was trying to use $RANDOM for a simple 1/0 check, but it kept failing. After a while I realized a new subshell always gives the same $RANDOM result:

% for i in {1..10}; do echo `echo $RANDOM`; sleep 1; done
13490
13490
13490
13490
13490
13490
13490
13490
13490
13490

Surely it should be more random than that?

Tested with:

zsh 5.0.7 (x86_64-pc-linux-gnu)
zsh 5.0.2 (x86_64-apple-darwin12.2.0)


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-02-24  2:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-23 20:22 $RANDOM initial state doesn't change Timo Sirainen
2015-02-23 23:27 ` Jan Larres
2015-02-24  2:08   ` Mikael Magnusson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).