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

[PATCH 0/1] zsh/random module



This is a resurrection of a module to provide an interface into the kernel random pool for the shell.

It provides a ro parameter SRANDOM (32-bit random integer)

It provides 2 math functions zrand_float() and zrand_int

zrand_int takes 0-3 arguments, an exclusive upper bound, a lower bound, a flag to make the upper bound inclusive.  It is equivalent to SRANDOM with no arguments.

zrand_float takes no arguments and returns a floating point number between 0 and 1, inclusive.

I am still working on the test harness.  I'm thinking about using a C program for analysis of shell output, but no current test harness does anything like that.  (long double would really be helpful for larger bounds, 1-20 works, 1-100 causes overflows)

This version has no builtins.  Though I still think some could be useful, I have to admit that what I have in mind for them *can* be accomplished in shell by someone with moderate experience, if less efficiently.





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