Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
$RANDOM initial state doesn't change
- X-seq: zsh-workers 34625
- From: Timo Sirainen <tss@xxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: $RANDOM initial state doesn't change
- Date: Mon, 23 Feb 2015 22:22:19 +0200
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
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)
Messages sorted by:
Reverse Date,
Date,
Thread,
Author