For a study, I want to randomly assign cases (individuals) to one of five
groups (they don't need to have equal numbers). On the Mac, the code snippet
below results in a distribution that is random.
On Windows the results are decidedly not random.
Have I made a silly mistake?
OS 10.4.7
2006r3
Note: efResults.text
Michael
------------------
dim i,c,t,myMax as integer
dim g1,g2,g3,g4,g5 as integer
dim s as string
dim d as integer
myMax = val(efMax.text)
for i = 1 to myMax // default = 10,000
Dim r as New Random
d = (r.InRange(1,5))
if d =1 then
efResults.AppendText str(i) + " Group 1"+chr(13)+chr(10)
g1 = g1 + 1
elseif d =2 then
efResults.AppendText str(i) + " Group 2"+chr(13)+chr(10)
g2 = g2 + 1
elseif d=3 then
efResults.AppendText str(i) + " Group 3"+chr(13)+chr(10)
g3 = g3 + 1
elseif d=4 then
efResults.AppendText str(i) + " Group 4"+chr(13)+chr(10)
g4 = g4 + 1
elseif d = 5 then
efResults.AppendText str(i) + " Group 5"+chr(13)+chr(10)
g5 = g5 + 1
end if
next
//StaticTexts to display cum value
stG1.text = str(g1)
stG2.text = str(g2)
stG3.text = str(g3)
stG4.text = str(g4)
stG5.text = str(g5)
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>