From owner-freebsd-questions Fri Nov 23 9:35:39 2001 Delivered-To: freebsd-questions@freebsd.org Received: from hotmail.com (oe41.pav2.hotmail.com [64.4.36.98]) by hub.freebsd.org (Postfix) with ESMTP id 877E937B405 for ; Fri, 23 Nov 2001 09:35:32 -0800 (PST) Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Fri, 23 Nov 2001 09:35:32 -0800 X-Originating-IP: [212.58.59.34] From: "Lance Keay" To: "Andre` Niel Cameron" , "free bsd" , Cc: References: <034601c173cb$8edfee00$a50410ac@olmct.net> Subject: Re: Quick question Date: Fri, 23 Nov 2001 17:35:28 -0000 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Message-ID: X-OriginalArrivalTime: 23 Nov 2001 17:35:32.0370 (UTC) FILETIME=[4050FF20:01C17445] Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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" To: "free bsd" ; Cc: 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: beginners-cgi-unsubscribe@perl.org > For additional commands, e-mail: beginners-cgi-help@perl.org > > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message