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

Re: preliminary patch for zsh/random module



On 10/23/2022 9:01 PM, Bart Schaefer wrote:
On Sat, Oct 22, 2022 at 8:44 PM Clinton Bunch <cdb_zsh@xxxxxxxxxxx> wrote:
It still needs testing on more platforms and additional error-checking
as well as documentation, but I was hoping for some feedback on the
general ideas.
Silly nits:
* Typo in the introductory comment.
I'm pretty sure I've since found and changed all the instances of Zoltan's name.
* Indentation is funny, it looks like you may have used tab width
other than 8 characters, which is the standard for zsh C code.  (Or
just never use tabs to indent.)
Blame notepad.  Thunderbird doesn't allow me to attach inline, so I had to open in Notepad and cut-n-paste.  I didn't notice until after I sent it, how bad the indentation got messed up.
* There should be spaces on either side of assignment "=" signs.  You
haven't been consistent.
I think I fixed all those.  I haven't been consistent because it seems unnatural to me.  Waste of line width.

Aside to -workers:  It's probably time to remove Zoltan's name from
the copyright notices ... or more likely, to specify that the authors
of new files should replace his name with their own name there.

Actual question:  What's the use case for returning or printing a
block of random bytes?  Why does this need to be a builtin?
Mostly because I see constructs like read -k6 -u3 3</dev/urandom, also it would be nice to initialize an array with random numbers without having to use a loop to access SRANDOM n times.

Suggestion:  Treat SRANDOM like SECONDS, in that you can change the
type from integer to floating-point.  Then maybe the zrandom() math
function isn't needed?
That would seem confusing to me, and too easy to forget which state you left it in. zrandom was meant to be a replacement for rand48






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