zsh-workers
 help / color / mirror / code / Atom feed
* problems with RANDOM in subshells
@ 2002-01-31  3:20 Clint Adams
  2002-01-31  3:46 ` Zefram
  0 siblings, 1 reply; 6+ messages in thread
From: Clint Adams @ 2002-01-31  3:20 UTC (permalink / raw)
  To: zsh-workers; +Cc: 131337-forwarded

One can work around the problem described below by doing

: $RANDOM ; (echo $RANDOM) | cat

Should the random-seeding behavior be changed for subshells?

----- Forwarded message from Falk Hueffner <falk@debian.org> -----

For each subshell, $RANDOM gets initialized to the same value, which
leads to the same sequence of random numbers.  This makes
e. g. playlist shuffling functions way boring, and is generally not
what one would expect.

falk@borkum:~% (echo $RANDOM) | cat
12042
falk@borkum:~% (echo $RANDOM) | cat
12042
falk@borkum:~% (echo $RANDOM) | cat
12042

	Falk

-- System Information
Debian Release: 3.0
Architecture: alpha
Kernel: Linux borkum 2.4.16 #1 Sat Dec 1 23:02:59 CET 2001 alpha
Locale: LANG=C, LC_CTYPE=de_DE

Versions of packages zsh depends on:
ii  libc6.1                  2.2.4-7         GNU C Library: Shared libraries an
ii  libcap1                  1:1.10-12       support for getting/setting POSIX.
ii  libncurses5              5.2.20020112a-2 Shared libraries for terminal hand


----- End forwarded message -----


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

end of thread, other threads:[~2002-01-31 11:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-01-31  3:20 problems with RANDOM in subshells Clint Adams
2002-01-31  3:46 ` Zefram
2002-01-31  4:03   ` Bart Schaefer
2002-01-31  4:06     ` Bart Schaefer
2002-01-31 11:34       ` Peter Stephenson
2002-01-31 11:07   ` Peter Stephenson

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).