[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
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++) {
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,
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
\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
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.
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
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,
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