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

Re: use of rand() in zsh



On 10/10/2022 8:14 PM, Bart Schaefer wrote:
On Mon, Oct 10, 2022 at 4:38 PM Clinton Bunch <cdb_zsh@xxxxxxxxxxx> wrote:
Is there a reason that zsh goes out of the way (srand_deterministic) to
use the least random "random" function on modern Unix?
      The values of RANDOM form an intentionally-repeatable pseudo-random
      sequence; subshells that reference RANDOM will result in identical
      pseudo-random values unless the value of RANDOM is referenced or
      seeded in the parent shell in between subshell invocations.

This is e.g. so you aren't surprised by referencing $RANDOM inside
$(...) and getting a different result.

Doesn't zsleep_random's use of rand() break this predictability, or have I just not studied the use of zsleep_random enough?





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