View Full Version : porting php rand() to perl
nicmo
03-31-2010, 03:18 PM
hello, i am trying to modify a perl script but i really only know php lol
how would i go about on doing rand(10,19); on perl?
i tried all combinations i could think of but cant get it to work :(
Try:
print int(rand(9))+10;
Just find the range of the numbers (by subtracting), and add the minimum. In php:
echo rand(0, 9) + 10;
It's the same basics.
Range: 19-10 = 9
Minimum: 10
nicmo
03-31-2010, 03:42 PM
clever lol, thanks mate.
No problem, glad to help.
It seems your topic is solved... Please set the status to resolved.. To do this:
Go to your first post ->
Edit your first post ->
Click "Go Advanced" ->
Then in the drop down next to the title, select "RESOLVED"
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.