zsh-workers
 help / color / mirror / code / Atom feed
From: Clinton Bunch <cdb_zsh@zentaur.org>
To: "zsh-workers@zsh.org" <zsh-workers@zsh.org>
Subject: [PATCH 0/1] zsh/random module
Date: Sun, 24 Mar 2024 09:11:37 -0500	[thread overview]
Message-ID: <57374b5f-77b9-4dee-aaba-5c4bdeb1b281@zentaur.org> (raw)

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.



             reply	other threads:[~2024-03-24 14:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-24 14:11 Clinton Bunch [this message]
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

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=57374b5f-77b9-4dee-aaba-5c4bdeb1b281@zentaur.org \
    --to=cdb_zsh@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).