Reply to Re: random lottery draw funciton

Your name:

Reply:


Posted by Kevin Williamson on 11/11/06 11:22

Thanks Moot,

In view of the advice received I'll use a seed and run a test with
several thousand draws just to make sure.

I appreciate the help

Kevin

Moot wrote:
> Kevin Williamson wrote:
>> Hi,
>>
>> I've written a lottery programme in PHP that selects 10 winners a week
>> from approximately 18,000 shares.
>>
>> The problem I have is that of the ten winners one week the same share
>> number was drawn the next week and an adjacent share number the
>> following week (that just happened to be owned by the same member)
>> The program is now being looked at suspisciously.
>>
>> The main core of the random draw simply puts all the current share
>> numbers into an array ($currWinner), draws a random number using the
>> rand function between 1 and the number of shares ($lottshares) and
>> returns the share id number.
>>
>> for the random element ofthe program I use:
>>
>> $currWinner = rand(1,$lottShares);
>>
>> is this random enough? or is it possible that it needs seeding (although
>> I don't totally understand seeding?
>>
>>
>> Any help will be appreciated.
>>
>> thanks
>> Kevin
>
>
> While (all things being random) it isn't technically impossible, it is
> suspicious. Aside from the PHP version seeding issue Jerry mentioned,
> you may want to just run a big simulation, running a few thousand
> "drawings", then get the number of occurances of each share.
>
> If it looks like a few numbers start jumping out more often than
> others, you may have a problem. Ideally, in a truely random system,
> when run for a sufficiently large set, all shares should have
> relatively the same number of occurances.
>

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация