zsh-workers
 help / color / mirror / code / Atom feed
* [PATCH 0/1] zsh/random module
@ 2024-03-24 14:11 Clinton Bunch
  2024-03-25  2:34 ` Bart Schaefer
  2024-04-06  2:41 ` Clinton Bunch
  0 siblings, 2 replies; 7+ messages in thread
From: Clinton Bunch @ 2024-03-24 14:11 UTC (permalink / raw)
  To: zsh-workers

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.



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-04-06 16:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-24 14:11 [PATCH 0/1] zsh/random module Clinton Bunch
2024-03-25  2:34 ` Bart Schaefer
2024-03-26 12:47   ` Clinton Bunch
2024-03-26 13:01     ` Clinton Bunch
2024-03-26 18:25     ` Bart Schaefer
2024-04-06  2:41 ` Clinton Bunch
2024-04-06 16:48   ` Clinton Bunch

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).