473,396 Members | 1,971 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

rand function for lottery program

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
Nov 10 '06 #1
0 1225

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: August1 | last post by:
A handful of articles have been posted requesting information on how to use these functions in addition to the time() function as the seed to generate unique groups (sets) of numbers - each group...
6
by: ChasW | last post by:
given the following example: Using gcc, this compiles, runs, and outputs as expected, but on vc++.net 2003, the first number is always the same despite the time seed. #include <ctime>...
7
by: Chris Gordon-Smith | last post by:
I have a simulation program that calls the rand() function at various points while it executes. For the user interface that displays statistics etc. while the program runs, I use the Lazarus GUI...
36
by: Ben Justice | last post by:
For a program in c, I need some random numbers for a system were people are placing bets. This is not a commerical project btw. Generally, I tend to rely on things from the standard library,...
4
by: Bill Burris | last post by:
Hi, With VS .NET 2003 the rand() function sometimes returns a number equal to RAND_MAX. The docs say: The rand function returns a pseudorandom integer in the range 0 to RAND_MAX. Does this...
8
by: Miktor | last post by:
I'm trying to write a lottery number generator for the uk national lottery. Any clues where I'm going wrong? #include <cstdlib> #include <iostream> using namespace std; int main ()
7
by: john_smith_1221 | last post by:
Hello, I need to use the rand() function to generate a random value, I already know how to do it with srand(time(NULL)) and its "randomness" is sufficient for me, the problem is my code requires to...
8
by: ImortalSorrow | last post by:
Hey, I'm quite new in programing so need some help with this lottery program I'm making. What I'm trying to do is very simple, simulate a lottery but my effords are in vain since when I'm compiling...
4
by: 1q2w3e | last post by:
You are to create a lottery game program that allows a user to simulate playing the lottery. In this lottery game, the winning number combination comprises four unique numbers, each in the range of...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.