At 11:35 AM -0600 11/6/08, WEISD wrote:
http://www.weisd.com/store2/WINHD-9022.php
Not me -- I get a normal distribution.
Cheers,
tedd
Thanks Tedd, That is because it is using time now and not rand...
Just as point of notice.
When I ask a question and provide a url, I keep the url t
1. change the number to a string: $t = (string) time();
2. chop off the last char of the string: $char = substr($t, -1);
3. you're done...: include "footer$char.html";
Time wins certainly produces better results, at least for what I am
doing, than rand...
Thanks all for your input...
Stephen wrote:
> On Thu, 11/6/08, WEISD <[EMAIL PROTECTED]> wrote:
>
>
>>> That is strange. I get pretty balanced results on this
>>>
>> computer.
>>
>>> >>
>>> $histogram = array_fill(1, 10, 0);
>>>
>>> $iterations = 20;
>>>
>>> for ($i = 0; $i < $iterations; ++$i) {
>>>++$h
http://www.weisd.com/store2/WINHD-9022.php
Not me -- I get a normal distribution.
Cheers,
tedd
Thanks Tedd, That is because it is using time now and not rand...
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
At 10:30 AM -0600 11/6/08, WEISD wrote:
You can see it in action here at the bottom of the page there is a
footer. Each footer is the same right now except I have numbered
them for testing.
As I refresh the page, I get footer10 almost always with an
occasional 2 or 4 here and there...
http
WEISD wrote:
>
>>
>> Computer functions to generate random numbers are not designed to do
>> what their name suggests.
>>
>> Software testing requires repeatability, and this includes random
>> number generation.
>>
>> Without knowing how PHP seeds the generator it is difficult to predict
>> what
WEISD wrote:
Computer functions to generate random numbers are not designed to do
what their name suggests.
Software testing requires repeatability, and this includes random
number generation.
Without knowing how PHP seeds the generator it is difficult to predict
what it will do.
I st
That is strange. I get pretty balanced results on this computer.
Andrew
Simple code,
You can see it in action here at the bottom of the page there is a footer.
Each footer is the same right now except I have numbered them for testing.
As I refresh the page, I get footer10 almost alwa
Computer functions to generate random numbers are not designed to do what
their name suggests.
Software testing requires repeatability, and this includes random number
generation.
Without knowing how PHP seeds the generator it is difficult to predict
what it will do.
I still think taki
WEISD wrote:
>
>> That is strange. I get pretty balanced results on this computer.
>>
>> >
>> $histogram = array_fill(1, 10, 0);
>>
>> $iterations = 20;
>>
>> for ($i = 0; $i < $iterations; ++$i) {
>>++$histogram[round(rand(1, 10))];
>> }
>>
>> print_r($histogram);
>>
>> ?>
>>
>> Andrew
>
>
On Thu, 11/6/08, WEISD <[EMAIL PROTECTED]> wrote:
> > That is strange. I get pretty balanced results on this
> computer.
> >
> > >
> > $histogram = array_fill(1, 10, 0);
> >
> > $iterations = 20;
> >
> > for ($i = 0; $i < $iterations; ++$i) {
> >++$histogram[round(rand(1, 10))];
> > }
> >
[snip]
You can see it in action here at the bottom of the page there is a
footer.
Each footer is the same right now except I have numbered them for
testing.
As I refresh the page, I get footer10 almost always with an occasional
2 or
4 here and there...
[/snip]
So there fore it is random, or
""Gary M. Josack"" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
Stephen wrote:
On a php web page I want to generate a random number between say 1 and
10 and then use that number to reference a particular file in
an include tag.
Is there an easy way to do this?
Get the tim
On Thu, Nov 6, 2008 at 10:53 AM, WEISD <[EMAIL PROTECTED]> wrote:
>
> ""Gary M. Josack"" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
>>
>> Stephen wrote:
On a php web page I want to generate a random number between say 1 and
10 and then use that number to reference
On Thu, Nov 6, 2008 at 3:52 AM, Amisha_Sharma <[EMAIL PROTECTED]> wrote:
>
> Hi
>
> you can use PHP rand() function for selecting a random number between 1 to
> 100.
Amisha,
Welcome to the list, but please don't top post. For a list of all
the guidelines for the official PHP lists, inclu
Hi
you can use PHP rand() function for selecting a random number between 1 to
100.
http://www.senpai-it.com/dedicated_servers.php Senpai IT Solutions
Dedicated Server at low cost
WEISD wrote:
>
>
> On a php web page I want to generate a random number between say 1 and 10
> and then use t
On Wed, 2008-11-05 at 12:41 -0600, WEISD wrote:
> On a php web page I want to generate a random number between say 1 and 10
> and then use that number to reference a particular file in an include tag.
>
>
>
> Is there an easy way to do this?
>
> Thanks
>
include "manual.php";
lesson = new
gt;> There are a number of things you can do with that to select a random file
>>> and
>>> include it. Have an associative array where the random number matches an
>>> array key and the value is the filename you want, is one method.
>>>
>>> J
--- Original Message -
From: "WEISD" <[EMAIL PROTECTED]>
To: php-general@lists.php.net
Date: Wed, 5 Nov 2008 12:41:21 -0600
Subject: [PHP] Random number generator
On a php web page I want to generate a random number between say 1
and 10
and then use that number to referen
Stephen wrote:
On a php web page I want to generate a random number
between say 1 and 10
and then use that number to reference a particular file in
an include tag.
Is there an easy way to do this?
Get the time and use the last digit converting 0 to 10.
Stephen
rand(1, 10);
--
P
age -
From: "WEISD" <[EMAIL PROTECTED]>
To: php-general@lists.php.net
Date: Wed, 5 Nov 2008 12:41:21 -0600
Subject: [PHP] Random number generator
On a php web page I want to generate a random number between say 1 and
10
and then use that number to reference a particular fi
s one method.
Just starting out with PHP or is this a homework assignment? :)
-TG
- Original Message -
From: "WEISD" <[EMAIL PROTECTED]>
To: php-general@lists.php.net
Date: Wed, 5 Nov 2008 12:41:21 -0600
Subject: [PHP] Random number generator
>
> On a php we
> On a php web page I want to generate a random number
> between say 1 and 10
> and then use that number to reference a particular file in
> an include tag.
>
>
>
> Is there an easy way to do this?
Get the time and use the last digit converting 0 to 10.
Stephen
--
PHP General Mailing List
On a php web page I want to generate a random number between say 1 and 10
and then use that number to reference a particular file in an include tag.
Is there an easy way to do this?
Thanks
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
24 matches
Mail list logo