Ted S. wrote:
> $Bill Luebkert graced perl with these words of wisdom:
>
>
>>Eric Germann wrote:
>>
>>
>>>srand () is your friend
>>
>>rand automatically calls srand.
>
>
> Unless the OP is using a version of Perl prior to 5.004. :-p
Now there's a waste.
--
,-/- __ _ _
[EMAIL PROTECTED] graced perl with these words of wisdom:
> 1. Why does perl behave that way?
> 1a. Is perl alright, and it's me who behaves strange?
"Anyone who attempts to generate random numbers by deterministic means is,
of course, living in a state of sin." -- John von Neumann. :-)
--
Te
$Bill Luebkert graced perl with these words of wisdom:
> Eric Germann wrote:
>
>> srand () is your friend
>
> rand automatically calls srand.
Unless the OP is using a version of Perl prior to 5.004. :-p
--
Ted
Barney: Hey, Homer, you're late for English.
Homer: Who needs English? I'm
[EMAIL PROTECTED] wrote:
Hello everybody,
i did this:
for($x=0;$x<100;$x++)
{
$c=rand((100));
if(length($c)<6)
{
$rnd{$c}++;
}
}
foreach $rnd (keys %rnd)
{
print qq($rnd{$rnd} x $rnd\n);
}
which produced this:
29 x 62500
33 x 15625
30 x 93750
27 x 31250
23 x 0
30 x 46875
29 x
I have been using following for a long time and for sure is returning unique
random number between the given range
my $startPoint = 111;
my $endPoint = 999;
my $randNumber = int(rand($endPoint - $startPoint +1)) + $startPoint;
for (my $i=1;$i<=20;$i++) {
print "$randNumber\n";
$
Eric Germann wrote:
> srand () is your friend
rand automatically calls srand.
--
,-/- __ _ _ $Bill LuebkertMailto:[EMAIL PROTECTED]
(_/ / )// // DBE CollectiblesMailto:[EMAIL PROTECTED]
/ ) /--< o // // Castle of Medieval Myth & Magic http://
>From "Programming Perl", 3rd Edition:
29.2.119. rand
rand EXPR
rand
This function returns a pseudorandom floating-point number greater than
or equal to 0 and less than the value of EXPR. (EXPR should be
positive.) If EXPR is omitted, the function returns a floating-point
number between 0 an
srand () is your friend
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
[EMAIL PROTECTED]
Sent: Monday, October 11, 2004 7:03 PM
To: [EMAIL PROTECTED]
Subject: Random?
Hello everybody,
i did this:
for($x=0;$x<100;$x++)
{
$c=rand((100));
[EMAIL PROTECTED] wrote:
> Hello everybody,
>
> i did this:
>
> for($x=0;$x<100;$x++)
> {
> $c=rand((100));
> if(length($c)<6)
> {
> $rnd{$c}++;
> }
> }
> foreach $rnd (keys %rnd)
> {
> print qq($rnd{$rnd} x $rnd\n);
> }
>
> which produced this:
>
> 29 x 62500
> 33 x 1562
Hello everybody,
i did this:
for($x=0;$x<100;$x++)
{
$c=rand((100));
if(length($c)<6)
{
$rnd{$c}++;
}
}
foreach $rnd (keys %rnd)
{
print qq($rnd{$rnd} x $rnd\n);
}
which produced this:
29 x 62500
33 x 15625
30 x 93750
27 x 31250
23 x 0
30 x 46875
29 x 78125
which confused
Hi,
the last Character of $line seems to be a "\n"
try this:
chomp($line);
print TESTOUTPUT "$line " . length($address) . $address;
Friedel
-Ursprungliche Nachricht-
Von: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Auftrag von
Gary Kuznitz
Gesendet: Montag, 11. Oktober 2004 18:06
An:
> -Original Message-
> Could someone please help me figure out what I am doing
> wrong. I have this statement:
> print TESTOUTPUT "$line" .length($address). $address;
>
> It's printing "$line" to a file just fine. It's printing
> .length($address).
> on the next line and I'd like to
X-No-archive: yes
Hi,
Could someone please help me figure out what I am doing wrong. I
have this statement:
print TESTOUTPUT "$line" .length($address). $address;
It's printing "$line" to a file just fine. It's printing .length($address).
on the next line and I'd like to see all of it on th
On Sun, 10 Oct 2004, James wrote:
> I am writing a program to read from an input file and
> verify or not if the Quantity equal to the number of
> parts. The problem is some of the parts can be in 2 or
> 3 lines. Fromthe data file, the quantity match the
> number of parts but I cannot find the logi
14 matches
Mail list logo