I've seen many other ways to do this in other programming languages... Though I havent found one in Perl yet...
What I want to accomplish is to set two numbers:
$minimum = 100;
$maximum = 4000;
Then to create a random integer between those two. (whole number) ($random_num)
I've looked into this site: http://perlmeme.org/howtos/perlfunc/rand_function.html
Which is a good resource, although does not do exactly that.
The random number or a range of random numbers can be generated using the $RANDOM variable. It generates a random number between 0 and 32767 by default. But you can set the range of numbers for generating random numbers by dividing the value of $RANDOM with a specific value.
Let me get that out of the way first — CSS has no built-in “random” function, no Math. random() equivalent and no way to generate a random number or a random color at all.
my $x = $minimum + int(rand($maximum - $minimum));
http://perldoc.perl.org/functions/rand.html
Note this range excludes $maximum
itself. Add 1 to make it inclusive.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With