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

Re: use of rand() in zsh



On 10/11/2022 1:31 AM, Roman Perepelitsa wrote:

I would use it, and I think most uses of $RANDOM would be better off
as $SRANDOM.

In the meantime I'm using this:
https://gist.github.com/romkatv/a6cede40714ec77d4da73605c5ddb36a

Roman.

The question then is how should it be implemented:

1. Implement a shopt that changed the behavior of RANDOM (Pleasing because of the elegance of using RANDOM for good random values, but probably too confusing)

2. Simply implement a new parameter called SRANDOM (simplest, but change to core zsh interface)

3. Write a module (e.g. zsh/random) that introduced a new special parameter when loaded (more complicated, but isolated to those who want it and possible to fail on systems that don't have a kernel entropy pool)





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