Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Perl Beginners > generating numb...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 6 Topic 11025 of 11065
Post > Topic >>

generating number ranges using rand function

by myklass@[EMAIL PROTECTED] (Aruna Goke) May 4, 2008 at 04:09 PM

I have worked on the code below and am able to generate the 15digit 
lenght required .

However, what i wish to achieve is to make sure all the output comes out 
in 15 digits each. a sample of my output is as below.

Can someone guide on how to make all come out in 15digits.

Thank you.

Goksie

#!/usr/bin/perl

use warnings;
use strict;
use Perl6::Say;

# make a subrouting to generate random numbers;
my ($ab, $ac, $ad, $a, $b, $c, $d);
sub pin_number($$$){
($b, $c, $d) = @[EMAIL PROTECTED]
($a=0; $a<=10; $a++){
$ab = int(rand($b));
$ac = int(rand($c));
$ad = int(rand($d));
say $ab, $ac, $ad;
}

  }
pin_number(99999,99999,99999);

_OUTPUT_
737027546660830
4806662848095
88295762678621
823446006493218
459372786221944
897977689470748
924616140070650
897575667638802
269285958818874
740564487266857
17098933279094




 6 Posts in Topic:
generating number ranges using rand function
myklass@[EMAIL PROTECTED]  2008-05-04 16:09:53 
Re: generating number ranges using rand function
noreply@[EMAIL PROTECTED]  2008-05-04 17:54:05 
Re: generating number ranges using rand function
Jenda@[EMAIL PROTECTED]   2008-05-04 18:38:43 
Re: generating number ranges using rand function
krahnj@[EMAIL PROTECTED]   2008-05-04 13:43:52 
Re: generating number ranges using rand function
myklass@[EMAIL PROTECTED]  2008-05-04 23:48:28 
Re: generating number ranges using rand function
rob.dixon@[EMAIL PROTECTE  2008-05-05 14:16:25 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Tue May 13 21:33:26 CDT 2008.