Mike,
The "fill the array section" fills an array so that
raynum(1) = 1
raynum(2) = 2
....
raynum(12) = 12
This is not very random, so the "shuffle" section of the code randomize
it. It basically randomly picks two items in the array and swaps them.
Let's say it picks 5 and 8. After one pass you would then have
raynum(1) = 1
raynum(2) = 2
....
raynum(5) = 8
....
raynum(8) = 5
....
raynum(12) = 12
That is, all numbers are the same except the two it swapped.
Because this section is a loop, it does 20 random swaps. With 12
numbers, doing 20 swaps should do a pretty good job shuffling, even if
occasionally, the same slots got swapped.
So, the first thing you need to do is change each 12 to 24:
Dim raynum(1 To 12) is just creating an array that can hold 12 different
numbers. If you make it 1 To 24, it will hold 24 numbers.
For i = 1 To 12 is used to loop through the array so you are looking at
each of the 12 items in the array with raynum(i). If raynum now has 24
items, you need For i = 1 To 24 to loop through all 24 items in the array.
Int((12 * Rnd) + 1) is the formula to give you a random number between 1
and 12. It is used in this code to randomly pick one of the 12 slots to
swap with another of the 12 slots. If you have 24 slots, you need a
number between 1 and 24; thus, you need Int((24 * Rnd) + 1)
Finally, the shuffling loop of For i = 1 To 20. This is used to perform
20 swaps, which will give a nice shuffling if there are only 12 slots,
but it won't be too good if there are 24. This number can really be as
large as you want, but if 20 works well for 12 slots, I think 40 will be
good for 24 slots so you should make it For i = 1 To 24
Does that make sense?
--David
Mike
In the code there are 5 occurrances of "12" - change them all to "24".
-- john ATSIGN PPTAlchemy.co.uk Free PPT Hints, Tips and Tutorials
http://www.pptalchemy.co.uk/powerpoint_hints_and_tips_tutorials.html
--
David M. Marcovitz
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/
Microsoft PowerPoint MVP
Associate Professor, Loyola University Maryland