468,765 Members | 978 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,765 developers. It's quick & easy.

rand function for lottery program


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.

Nov 10 '06 #1
0 1054

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by ChasW | last post: by
7 posts views Thread by Chris Gordon-Smith | last post: by
36 posts views Thread by Ben Justice | last post: by
4 posts views Thread by Bill Burris | last post: by
8 posts views Thread by Miktor | last post: by
4 posts views Thread by 1q2w3e | last post: by
reply views Thread by Marin | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.