View Single Post
  #3   Report Post  
JE McGimpsey
 
Posts: n/a
Default

Couple of caveats, he

0) Everything that follows is useless for choosing or predicting numbers
in an external lottery. Playing 1-2-3-4-5 is just as sound a strategy as
playing a randomly generated number, assuming a fair game. If you're
generating your own lottery's random numbers, read on.

1) Unless a,b,c,d and e are declared as Integers or Longs (which may not
be "obvious" at first, this routine generates non-integers, which aren't
very useful for lottery numbers.

2) The claimed range is [1-50], the actual range is [0-50].

3) Using Timer to bias each number doesn't seem to me to "make better
random numbers" than using Randomize once. Since Seed2-Int(Seed2) = 0,
it will tend to bias the results away from 0.

4) In MacXL, using Seed2-Int(Seed2) doesn't do anything since Timer
returns an integer.

5) In the case where Seed2-Int(Seed2) produces a value 0, using a cap
of 50 will tend to bias upward the number of times 50 is produced.

One way to get N random integers from a universe of M integers can be
found at

http://www.mcgimpsey.com/excel/randint.html



In article ,
Andrea Jones wrote:

Here's some code that will make better random numbers for you so you don't
keep getting the same answers (you'll obviously have to declare the variables
a, b, c, etc first), it generates 5 random numbers in the range 1-50: