Showing posts with label Fold (Unix). Show all posts
Showing posts with label Fold (Unix). Show all posts

Saturday, June 3, 2017

macOS Sierra: Generating Integers with Arbitrary Size

Command (Testing with 15 digits):

$ rnd=$(cat /dev/urandom | LC_CTYPE=C tr -dc 0-9 | fold -w15 | head -1 | sed 's/^0*//;'); echo $rnd; echo $(($rnd / 2));


Result (Second line is the number half the size of the first line to test if arithmetic operation works):

585206567422781
292603283711390