J. Linne J. Linne - 1 month ago 5
Perl Question

Edit executavble command to make random number generator in Perl

I was using this module for Perl, Crypt::PRNG, to generate random numbers. The number-generation seems truly random when using the random string command, it can use digits 0-9 as well as other characters and create a random string of the specified number of digits, the problem is the leading 0's.

perl -MCrypt::PRNG=:all -E "say random_string_from("1234567890", n)"

where n is the number of digits, is there a executable command similar to the one above to fix the leading 0's so I can for sure get an n digit number? My intent is to fix only the first digit to "123456789". Does anyone know how to do this? Thanks in advance.


How about

random_string_from("123456789", 1) . random_string_from("1234567890", $n-1)