The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
how do i generate random integer using only shell script sridhusha Shell Programming and Scripting 1 12-30-2007 11:46 PM
Generate a random password chiru_h Shell Programming and Scripting 5 10-07-2007 05:03 PM
Random number generation tej.buch High Level Programming 1 02-13-2006 06:07 AM
generate random number in korn shell frustrated1 Shell Programming and Scripting 2 12-31-2005 03:49 AM
How to generate a random number? MacMonster High Level Programming 2 10-15-2001 09:35 AM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-17-2008
Registered User
 

Join Date: Mar 2008
Posts: 12
generate random number in perl

Could any one tell how can I generate random number from (0, 100..200) in perl?

Thanks!
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 03-17-2008
Registered User
 

Join Date: Jan 2008
Posts: 294
one way:

Code:
my @n = (0,100..200);
my $i = $n[int rand @n];
print $i;
Reply With Quote
  #3 (permalink)  
Old 03-17-2008
Registered User
 

Join Date: Mar 2008
Posts: 12
Thanks a lot!
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 02:15 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0