zsh-workers
 help / color / mirror / code / Atom feed
From: Clinton Bunch <cdbunch@zentaur.org>
To: zsh-workers@zsh.org
Subject: Re: use of rand() in zsh
Date: Mon, 10 Oct 2022 20:32:11 -0500	[thread overview]
Message-ID: <efdac912-938c-67e5-6ad9-22b978e8156e@zentaur.org> (raw)
In-Reply-To: <a20190b5-b4a0-a72d-555e-d125fd0222d1@zentaur.org>

On 10/10/2022 8:27 PM, Clinton Bunch wrote:
> On 10/10/2022 8:14 PM, Bart Schaefer wrote:
>> On Mon, Oct 10, 2022 at 4:38 PM Clinton Bunch <cdb_zsh@zentaur.org> 
>> 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.
>
> Well, I guess that explains why it uses rand, but doesn't really 
> explain to me why you'd *want* this behavior.  I would expect to get a 
> different value in a subshell than I got in the parent shell.  I'm 
> supposedly looking for random numbers.
>
>  I guess I side with OpenBSD who changed the default behavior of rand().
>
>
I wonder if it wouldn't be worthwhile to create a module that gave 
access to better sources of random numbers on the systems that support them.



  reply	other threads:[~2022-10-11  1:32 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-10 23:32 Clinton Bunch
2022-10-11  1:14 ` Bart Schaefer
2022-10-11  1:27   ` Clinton Bunch
2022-10-11  1:32     ` Clinton Bunch [this message]
2022-10-11  3:34       ` Bart Schaefer
2022-10-11  3:44         ` Clinton Bunch
2022-10-11  6:31           ` Roman Perepelitsa
2022-10-11 12:51             ` Clinton Bunch
2022-10-11 13:23               ` Peter Stephenson
2022-10-11 14:15                 ` Clinton Bunch
2022-10-11 14:48                   ` Peter Stephenson
2022-10-11 12:35   ` Clinton Bunch
2022-10-11 13:18     ` Peter Stephenson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=efdac912-938c-67e5-6ad9-22b978e8156e@zentaur.org \
    --to=cdbunch@zentaur.org \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).