Re: Random Numbers

2003-06-25 Thread Keith C. Ivey
[EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

 On my unix (Solaris 2.5.1, 2.7, 2.8)/linux boxes perl 5.005
 'works', 5.6 and above doesn't (various DOS's 4.0.1.8 on work
 (4.0.1.6 doesn't) - except for one old Suse linux on 5.005 which
 doesn't) - it must be some oddness w/ rand. 

It depends on the setting of randbits in the configuration.  
Try this:

perl -MConfig -le print $Config{randbits}

(use single quotes on non-Windows platforms, of course).
The perls that give lots of 0's will have randbits set
to 15.

-- 
Keith C. Ivey [EMAIL PROTECTED]
Washington, DC

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Random Numbers

2003-06-23 Thread Jarrett Malone

 Let me apologize is advance if this is
 wrong list or has already been addressed etc.
 rand seems to produce an abnormally high
 number of zeros, like 20 or 30 per million
 
active perl binary v5.8.0 Build 804
  
 
 $t = 0;
 for($k=0;$k100;$k++) {
$t = rand(1);
if ($t == 0.0) { print tt $t\n; }
 }
 
 Thanks -- Jarrett
 

 


__
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Random Numbers

2003-06-23 Thread Jenda Krynicky
From: Jarrett Malone [EMAIL PROTECTED]
  Let me apologize is advance if this is
  wrong list or has already been addressed etc.
  rand seems to produce an abnormally high
  number of zeros, like 20 or 30 per million
 
 active perl binary v5.8.0 Build 804
 
 
  $t = 0;
  for($k=0;$k100;$k++) {
   $t = rand(1);
   if ($t == 0.0) { print tt $t\n; }
  }

I seem to get more 0.5s than 0.0s:

$t = 0;
$zeroes = 0;
$halves = 0;
for($k=0;$k100;$k++) {
$t = rand(1);
$zeroes++ if ($t == 0.0);
$halves++ if ($t == 0.5);
}
print 0.0: $zeroes\n0.5: $halves\n;

And results:

0.0: 27
0.5: 41

0.0: 26
0.5: 33

0.0: 29
0.5: 28

0.0: 32
0.5: 38

0.0: 26
0.5: 31

Jenda
= [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Random numbers

2002-10-29 Thread Krishna, Hari
Title: RE: Terrible at my logic



Hi 
friends,
 I want to generate some 1000 or more passwords for some NT 
machine. 
I 
should be able to generate an 8 digit alphanumeric random numbers from the list 
of characters.

Say I 
have 3 strings...
First 
string : 0 - 9 numbers
Second 
string : A - Z characters
Third 
string: a - z characters.

Now I 
should be able to generate strings like:

"abCd16Sz"
"U8Yb90vc"
"Nt7gO0PL"

something like that.

Is 
there a way to generate such kind of random numbers 8 characters 
long???

I saw 
in a bok that there is a module in PERL
MATH::TrulyRandom

but I 
am not sure if it helps. I will keep trying.


any 
inputs appreciated. 

Hope I 
can get some help.


Thanks 
and Regards,
Hari.


RE: Random numbers

2002-10-29 Thread Patrick Connolly
Title: RE: Terrible at my logic









@a =
(0..9,A..Z,a..z);

for($I=0;$I1000;$I++)
{

 for($x=0;$x8;$x++) {

 $index = rand @a;

 print $a[$index];

 }

 print \n;

}



-Original
Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Krishna, Hari
Sent: Tuesday, October 29, 2002
12:48 PM
To: 'FARRINGTON, RYAN';
[EMAIL PROTECTED]
Subject: Random numbers



Hi friends,


I want to generate some 1000 or more passwords
for some NT machine. 

I should be able to
generate an 8 digit alphanumeric random numbers from the list of characters.



Say I have 3 strings...

First string : 0 - 9
numbers

Second string : A - Z
characters

Third string: a - z
characters.



Now I should be able to
generate strings like:



abCd16Sz

U8Yb90vc

Nt7gO0PL



something like that.



Is there a way to
generate such kind of random numbers 8 characters long???



I saw in a bok that there
is a module in PERL

MATH::TrulyRandom



but I am not sure if it
helps. I will keep trying.





any inputs appreciated. 



Hope I can get some help.





Thanks and Regards,

Hari.








RE: Random numbers

2002-10-29 Thread Peter Eisengrein
Title: RE: Terrible at my logic



perldoc -f rand

here's an example: 
printint rand ;


  -Original Message-From: Krishna, Hari 
  [mailto:[EMAIL PROTECTED]]Sent: Tuesday, October 29, 2002 
  12:48To: 'FARRINGTON, RYAN'; 
  [EMAIL PROTECTED]Subject: Random 
  numbers
  Hi 
  friends,
   I want to generate some 1000 or more passwords for some 
  NT machine. 
  I 
  should be able to generate an 8 digit alphanumeric random numbers from the 
  list of characters.
  
  Say 
  I have 3 strings...
  First string : 0 - 9 numbers
  Second string : A - Z characters
  Third string: a - z characters.
  
  Now 
  I should be able to generate strings like:
  
  "abCd16Sz"
  "U8Yb90vc"
  "Nt7gO0PL"
  
  something like that.
  
  Is 
  there a way to generate such kind of random numbers 8 characters 
  long???
  
  I 
  saw in a bok that there is a module in PERL
  MATH::TrulyRandom
  
  but 
  I am not sure if it helps. I will keep trying.
  
  
  any 
  inputs appreciated. 
  
  Hope 
  I can get some help.
  
  
  Thanks and Regards,
  Hari.


RE: Random numbers

2002-10-29 Thread Patrick Connolly
Title: RE: Terrible at my logic









To make it even a little more fun you could also vary the length of the
password:



@a = (0..9,A..Z,a..z); # password
charactors

@b = (6..14);
# length of
password

for($I=0;$I1000;$I++) {


for($x=0;$x$b[rand @b];$x++) {


print $a[rand @a];

 }

 print
\n;

}

-Original
Message-
From: Patrick Connolly
[mailto:[EMAIL PROTECTED]]
Sent: Tuesday, October 29, 2002
1:00 PM
To: 'Krishna, Hari'; 'FARRINGTON,
RYAN'; '[EMAIL PROTECTED]'
Subject: RE: Random numbers



@a = (0..9,A..Z,a..z);

for($I=0;$I1000;$I++) {


for($x=0;$x8;$x++) {

 $index = rand @a;

 print $a[$index];

 }


print \n;

}



-Original
Message-
From:
[EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Krishna, Hari
Sent: Tuesday, October 29, 2002
12:48 PM
To: 'FARRINGTON, RYAN';
[EMAIL PROTECTED]
Subject: Random numbers



Hi
friends,


I want to generate some 1000 or more passwords
for some NT machine. 

I should
be able to generate an 8 digit alphanumeric random numbers from the list of
characters.



Say I
have 3 strings...

First
string : 0 - 9 numbers

Second
string : A - Z characters

Third
string: a - z characters.



Now I
should be able to generate strings like:



abCd16Sz

U8Yb90vc

Nt7gO0PL



something
like that.



Is there
a way to generate such kind of random numbers 8 characters long???



I saw in
a bok that there is a module in PERL

MATH::TrulyRandom



but I am
not sure if it helps. I will keep trying.





any
inputs appreciated. 



Hope I
can get some help.





Thanks
and Regards,

Hari.








RE: Random numbers

2002-10-29 Thread Krishna, Hari
Title: RE: Terrible at my logic



OH MY 
GOD!!!

That 
is soo overwhelming

I 
don't have enough thatyou 's to say THANKYOU ALL SO VERY 
MUCH

your 
humble servant,
Hari.



RE: Random numbers

2002-10-29 Thread Bullock, Howard A.
Title: RE: Terrible at my logic









sub GenRandomPW ($Length)

{

 # This subroutine generate a
relatively strong random password of a specified length.

 WriteLog($LogFile, Entered
GenRandomPW) if $DEBUG;



 my $Length = shift;



 my $password;

 my @chars = ('A'..'H', 'K', 'M', 'N',
'P'..'R', 'T'..'Y', '!', '@', '#', '$', '%', '', '*', 2..9, 'a'..'h', 'k',
'm', 'n', 'p'..'z');

 my $j = 0;

 while ($j3)

 {

 $password = ;

 my $i;

 for ($i=1;$i=$Length; $i++)

 {

 $password .= @chars [rand
(scalar @chars)];

 }

 $j = 0;

 if ($password =~ /[A-Z]+/) { $j++;
}

 if ($password =~ /[0-9]+/) { $j++;
}

 if ($password =~ /[a-z]+/) { $j++;
}

 if ($password =~
/[!@#\$%\*]+/) { $j++; }

 }

 return $password;

}





-Original Message-
From: Patrick Connolly
[mailto:[EMAIL PROTECTED]] 
Sent: Tuesday,
 October 29, 2002 1:08 PM
To: 'Krishna, Hari';
'FARRINGTON, RYAN'; [EMAIL PROTECTED]
Subject: RE: Random numbers



To make it
even a little more fun you could also vary the length of the password:



@a =
(0..9,A..Z,a..z); # password charactors

@b =
(6..14); # length of password

for($I=0;$I1000;$I++)
{


for($x=0;$x$b[rand @b];$x++) {

 print
$a[rand @a];

 }

 print
\n;

}

-Original
Message-
From: Patrick Connolly
[mailto:[EMAIL PROTECTED]]
Sent: Tuesday, October 29, 2002 1:00 PM
To: 'Krishna, Hari'; 'FARRINGTON,
RYAN'; '[EMAIL PROTECTED]'
Subject: RE: Random numbers



@a =
(0..9,A..Z,a..z);

for($I=0;$I1000;$I++)
{


for($x=0;$x8;$x++) {

 $index =
rand @a;

 print
$a[$index];

 }

 print
\n;

}



-Original
Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Krishna, Hari
Sent: Tuesday, October 29, 2002 12:48 PM
To: 'FARRINGTON, RYAN';
[EMAIL PROTECTED]
Subject: Random numbers



Hi
friends,


I want to generate some 1000 or more passwords
for some NT machine. 

I should
be able to generate an 8 digit alphanumeric random numbers from the list of
characters.



Say I
have 3 strings...

First
string : 0 - 9 numbers

Second
string : A - Z characters

Third
string: a - z characters.



Now I
should be able to generate strings like:



abCd16Sz

U8Yb90vc

Nt7gO0PL



something
like that.



Is there
a way to generate such kind of random numbers 8 characters long???



I saw in
a bok that there is a module in PERL

MATH::TrulyRandom



but I am
not sure if it helps. I will keep trying.





any
inputs appreciated. 



Hope I
can get some help.





Thanks
and Regards,

Hari.








RE: Random numbers

2002-10-29 Thread Thomas_M
Title: Message



Personally, I like 
to useCrypt::GeneratePassword. 
You can create passwords that are longer, yet easierfor users 
toremember and less likely to be written on a Post-it on their monitor. 


-- Mark 
Thomas 
[EMAIL PROTECTED] Internet Systems Architect User Technology Associates, 
Inc. 
$_=q;KvtuyboopuifeyQQfeemyibdlfee;; 
y.e.s. ;y+B-x+A-w+s; ;y;y; ;;print;;  

  
  -Original Message-From: Krishna, Hari 
  [mailto:[EMAIL PROTECTED]] Sent: Tuesday, October 29, 2002 12:48 
  PMTo: 'FARRINGTON, RYAN'; 
  [EMAIL PROTECTED]Subject: Random 
  numbers
  Hi 
  friends,
   I want to generate some 1000 or more passwords for some 
  NT machine. 
  I 
  should be able to generate an 8 digit alphanumeric random numbers from the 
  list of characters.
  
  Say 
  I have 3 strings...
  First string : 0 - 9 numbers
  Second string : A - Z characters
  Third string: a - z characters.
  
  Now 
  I should be able to generate strings like:
  
  "abCd16Sz"
  "U8Yb90vc"
  "Nt7gO0PL"
  
  something like that.
  
  Is 
  there a way to generate such kind of random numbers 8 characters 
  long???
  
  I 
  saw in a bok that there is a module in PERL
  MATH::TrulyRandom
  
  but 
  I am not sure if it helps. I will keep trying.
  
  
  any 
  inputs appreciated. 
  
  Hope 
  I can get some help.
  
  
  Thanks and Regards,
  Hari.


RE: Random numbers

2002-10-29 Thread Burak Gürsoy
you can use crypt():

#!/usr/bin/perl -w
use strict;

print generate_password(), \n for 1..1000;

sub generate_password

   return(substr(crypt(,join('',(0..9,'A'..'Z','a'..'z')[rand 62,rand
62])), -8 ));
}

if you want to check if the same string is generated, you can write some
control structure...


-Original Message-
From: [EMAIL PROTECTED]
[mailto:perl-win32-users-admin;listserv.ActiveState.com]On Behalf Of
Krishna, Hari
Sent: Tuesday, October 29, 2002 7:48 PM
To: 'FARRINGTON, RYAN'; [EMAIL PROTECTED]
Subject: Random numbers


Hi friends,
I want to generate some 1000 or more passwords for some NT machine.
I should be able to generate an 8 digit alphanumeric random numbers from the
list of characters.

Say I have 3 strings...
First string : 0 - 9 numbers
Second string : A - Z characters
Third string: a - z characters.

Now I should be able to generate strings like:

abCd16Sz
U8Yb90vc
Nt7gO0PL

something like that.

Is there a way to generate such kind of random numbers 8 characters long???

I saw in a bok that there is a module in PERL
MATH::TrulyRandom

but I am not sure if it helps. I will keep trying.


any inputs appreciated.

Hope I can get some help.


Thanks and Regards,
Hari.

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



Generating random numbers?

2002-05-28 Thread steve silvers

I have seen a few ok random number generator snippets but none really look 
like they work too well. Take the two below arrays.

@array qw(1 2 3 4 5 6 7 8 9);
@array2 qw(01 02 03 04 99 88);

I want to be able to get either single numbers or double numbers and limit 
how many to generate.

I can't seem to get srand to work. Any suggestions.
Steve.

_
Send and receive Hotmail on your mobile device: http://mobile.msn.com

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



Re: Generating random numbers?

2002-05-28 Thread Sisyphus


- Original Message -
From: steve silvers [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, May 29, 2002 3:51 AM
Subject: Generating random numbers?


 I have seen a few ok random number generator snippets but none really look
 like they work too well. Take the two below arrays.

 @array qw(1 2 3 4 5 6 7 8 9);
 @array2 qw(01 02 03 04 99 88);

 I want to be able to get either single numbers or double numbers and limit
 how many to generate.

my $how_many = 100; # for example
my @random_numbers = ();
for (my $i = 0; $i  $how_many; $i++) {
  push @random_numbers, int(rand(100));
  }

 I can't seem to get srand to work. Any suggestions.
 Steve.



You probably don't want to use 'srand' - with the earlier versions of perl I
believe it was necessary, but with the later versions you just use
'rand($maximum)' and that should produce numbers (less than $maximum) that
appear to be random. (It's discussed in 'perlfunc'.)
I think perl's rand function is adequate for most purposes - probably *not*
adequate for safe cryptographic purposes.

Hth.

Cheers,
Rob

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



Re: Generating random numbers?

2002-05-28 Thread Ron Grabowski

 I have seen a few ok random number generator snippets but none really look
 like they work too well. Take the two below arrays.

 http://search.cpan.org/search?mode=modulequery=random

Some modules that may be of interest:

 Math::Random
 Math::TrulyRandom
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs