Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: random once but not twice



Peter Stephenson wrote:

> You can also work around with the following
> rand48 function.
>
> (rand48; print $REPLY) (rand48; print $REPLY)

Works! Only I don't understand this syntax.
What does it do?

    seed=$(<$file)

and

    print $seed >$file

I suppose is some intentional circular
short-circuit to generate gibberish data?

BTW you could benefit from a spellchecker :)
Here is a spell-checked version of your comment

# Generate a 48-bit pseudo-random number as
# a floating point value between 0 and 1 in
# $REPLY.
#
# This version is slow but works around the fact
# that the random number seed doesn't propagate
# back from a subshell by storing the seed in
# a file.
#
# You can specify a file name, else
# ${ZDOTDIR:-~}/.zsh-rand48-seed is used, but
# if using the default be careful about
# simultaneous accesses from multiple shells.

Thanks :)

-- 
underground experts united
http://user.it.uu.se/~embe8573



Messages sorted by: Reverse Date, Date, Thread, Author