Sweepstakes/random generation algorithm and code 
Author Message
 Sweepstakes/random generation algorithm and code

Hi everyone!

I am doing a project to create a simple (yet hopefully effective) random
generation program that would simulate the 'drawing of a hat' sweepstakes
kind of thing.

Do any of you guys know something of this sort that is already developed and
that has source code available so I can change it and customize it to my
needs? If so kindly let me know by posting to me privately at

someone else's benefit).

Thanks!
David

P.S. I have cross posted this email to C++, Java, and Perl newsgroups. I
hope this is ok! :)



Tue, 24 Dec 2002 03:00:00 GMT  
 Sweepstakes/random generation algorithm and code
Russell,

Thanks for including c.l.s. in the crosspost. But the Smalltalk code is
so uninteresting:

(Deck newCards: 52) shake: 4

Regards,
--

Peter van Rooijen

fax, voice mail +31 20 866 2895



Wed, 25 Dec 2002 03:00:00 GMT  
 Sweepstakes/random generation algorithm and code
Quote:

>             int nSwap = rand() % CARDS;

    Bad, programmer! Bad!
    rand() is weak enough without further skewing its output by favoring
the lower numbers. To get what rand() can deliver in the way of
randomness do this:

 nSwap = (int) (((double)rand() / (double)RAND_MAX) * CARDS);

--
sma at rtd dot com



Wed, 25 Dec 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Random Key Generation in Win32

2. random number generation

3. Non-Random Generation of Strings from a Grammar?

4. Password Security and Random Generation

5. Random number generation

6. Random number generation in perl

7. Random Number Generation PERL 5.0

8. Random number generation?

9. generation of random numbers with perl

10. Q: Regarding random number generation

11. weighted random number generation

12. Random number generation

 

 
Powered by phpBB® Forum Software