View Single Post
  #8   Report Post  
Ragdyer
 
Posts: n/a
Default

Another way.

Just replace the "45" in this link with "50", and a hit of <F9 gives a new
"set".

http://tinyurl.com/8zr3a

--
HTH,

RD

---------------------------------------------------------------------------
Please keep all correspondence within the NewsGroup, so all may benefit !
---------------------------------------------------------------------------
"Biff" wrote in message
...
Hi!

In the meantime......try this for 6 unique picks from 1 - 50

In A1 enter 1
In A2 enter 2

Select A1 and A2 and drag to fill down to A50

In B1 enter: =RAND()

Double click the fill handle to copy down to A50.

Select both columns A and B. Sort on column B. Take the 6 values from

A1:A6.

Want to do it again? Hit function key F9 then sort.

Biff

"Steved" wrote in message
...
Hello Andrea from Steved

I ran your Lottery function to get
8.736513138
32.51254272
47.04566193
17.73767471
47.16249466

As you can see I've got 47 twice

Question what am I doing wrong please and what is require please to
generate
6 numbers.

Thankyou.


"Andrea Jones" wrote:

I've run 122757 iterations using this macro and there is no bias

towards
high
or low values. I should have mentioned that all the variables are
declared
as integers, I just wanted to give the gist of the code rather than the
whole
thing. When I ran this so that the average number of occurrences for
each
number was 2455 (122757 iterations) the number 50 occurred 2369 times.

Andrea Jones
http://www.allaboutoffice.co.uk
http://www.stratatraining.co.uk
http://www.allaboutclait.com

"JE McGimpsey" wrote:

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: