471,118 Members | 1,031 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,118 software developers and data experts.

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 1122

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

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.