New feature: SRANDOM
as in bash 5.1+, with upper bound
#705
McDutchie
started this conversation in
New features
Replies: 1 comment 2 replies
-
I can confirm that |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
SRANDOM
is a secure random number generator. It uses the OS implementation ofarc4random
(3) or, absent that, an integrated OpenBSD-based version that uses the ChaCha20 cipher. An upper bound can be set by assigning its value to SRANDOM; subsequent numbers will be uniformly distributed between 0 and the value of the upper bound minus one, in a way that avoids modulo bias.I'd like everyone to play with and test this new feature and report back – well, those of you who keep up with the dev branch, that is. It's on the dev branch only and will be in ksh 93u+m/1.1 and up. See 00b296c for all the info.
I am particularly interested in knowing whether this compiles and runs on more obscure systems (Solaris, QNX, AIX, HP-UX, Cygwin) as I am currently unable to test any of these due to broken hardware and lack of access.
Beta Was this translation helpful? Give feedback.
All reactions