this will give you a random number of 0 or 1. Just substitue the 1 for the number range you want. Note: I have found that the lowest and highest numbers do not appear to have the same randomness weighting as the middle range, probably due to the sprintf rounding, so add two to the range you want and disregard the lowest and highest returned.
#!usr/bin/perl srand; for($x=0; $x<20; $x++) { $holdRand=sprintf("%.0f", rand(1)); print"\n$holdRand"; } ----- Original Message ----- From: "Andre` Niel Cameron" <[EMAIL PROTECTED]> To: "free bsd" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Friday, November 23, 2001 3:04 AM Subject: Quick question > Hi, > > Anyone know how to get a whole random number in perl? > > rand(18) always gives decimals I need just like 12 or 7 anyone know? > > Regards, > Andre` C. > Technical Support > ԿԬ > -------------------------------------------------------------------------- -- > - > Visit our support manual at http://supportmanual.com/ > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]