'real' random numbers are not possible on a computer, but 'good enough' random numbers are available in /dev/random character device file. I have also written the zsh/random module that uses system calls to access the same kernel 'random' pool, but it has yet to be accepted for addition to the next release. It provides the SRANDOM parameter (32-bit unsigned) similar to modern bash, a zrand_float() math function for numbers between 0 and 1, and zrand_int(upper,lower,inclusive) to return an integer between two values (32-bit integer max)
On 2024-05-02 20:09, Lawrence Velázquez wrote:
Ok then at least this is intentional. How does one obtain a genuinely random number then? TBH, for my particular needs right now the standard behavior is perfect, but as a matter of principle I'd like to know how to get 'real' random numbers. There will be a way.The values of RANDOM form an intentionally-repeatable pseudo-random sequence; subshells that reference RANDOM will result in identical pseudo-random values unless the value of RANDOM is referenced or seeded in the parent shell in between subshell invocations.