![]() If RANDOM is unset, it loses its special properties, even if it is subsequently reset. The sequence of random numbers may be initialized by assigning a value to RANDOM. Related: ( Careful, shuf is not cryptographically safe by default. This feature of RANDOM is mentioned in the bash (1) manual RANDOM Each time this parameter is referenced, a random integer between 7 is generated. ![]() It's worth to state the following: shuf -i 2-0 echo $? # shuf: invalid input range: ‘18446744073709551616’: Value too large for defined data type Some examples: shuf -random-source='/dev/urandom' -n 100 -i 1-5 | perl -pe 's/\n/ /g ' For example, the device file /dev/urandom. An error is reported if file does not contain enough bytes. Shuf -random-source='/dev/urandom' -n 1 -i 1-100 īy default these commands use an internal pseudo-random generator initialized by a small amount of entropy, but can be directed to use an external source with the -random-source=file option. # Output 1 random value between 1 and 100 To give some quantitative backup for the above speed claim: (Note: In this example I decided that a 45-bit random integer would be more than sufficient, and also a tiny little bit faster than the 60-bit one.) Here is for example how you can get a 60-bit random number: ((RND=((RANDOM/dev/null 2>
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |