Hi All,
I'm having some difficulty getting my head around an "experiment" I'm trying to run. (This is just for some idea I have related to a thought experiment I'm working on and thought that I could generate a data set based on it, but I'm stuck on how to actually make it work).
The idea is based on Duffey & Saull's "Jar of Life" experiment, which has 25 white balls, and 5 black balls which are in a jar. Each of the 30 balls is drawn in succession. At the end you have a result that would look something like:
Where W = W=white and B = black.
SO this sequence is a random sequence every time, but there will always be exactly 25 White and 5 Black (this is the part that is doing my head in).
I created a routine to randomize 0 and 1 (Where 0 represents white, and 1 represents black) This I will actually store in a text field in a table, C30 in length, so later I can just use SQL commands to pluck out the patterns that I want after I run about 1,000,000 iterations of the test.
So I can do something like:
I'll of course bury that into a loop that runs 1,000,000 iterations, but this is the idea.
The problem is, HOW do I get it to produce only 25 White outcomes and 5 black outcomes in an iteration???
Best Regards,
Scott
MSc ISM, MIET, MASHRAE, CDCP, CDCS, CDCE, CTDC, CTIA, ATS
"Everything should be made as simple as possible, and no simpler."
I'm having some difficulty getting my head around an "experiment" I'm trying to run. (This is just for some idea I have related to a thought experiment I'm working on and thought that I could generate a data set based on it, but I'm stuck on how to actually make it work).
The idea is based on Duffey & Saull's "Jar of Life" experiment, which has 25 white balls, and 5 black balls which are in a jar. Each of the 30 balls is drawn in succession. At the end you have a result that would look something like:
Where W = W=white and B = black.
SO this sequence is a random sequence every time, but there will always be exactly 25 White and 5 Black (this is the part that is doing my head in).
I created a routine to randomize 0 and 1 (Where 0 represents white, and 1 represents black) This I will actually store in a text field in a table, C30 in length, so later I can just use SQL commands to pluck out the patterns that I want after I run about 1,000,000 iterations of the test.
So I can do something like:
Code:
White = 0
Black = 1
APPEND BLANK
FOR X = 1 to 30
REPLACE SEQUENCE WITH ALLTRIM(SEQUENCE)+ALLTRIM(STR((INT((White - BLACK + 1) * RAND( ) + Black))
ENDFOR
I'll of course bury that into a loop that runs 1,000,000 iterations, but this is the idea.
The problem is, HOW do I get it to produce only 25 White outcomes and 5 black outcomes in an iteration???
Best Regards,
Scott
MSc ISM, MIET, MASHRAE, CDCP, CDCS, CDCE, CTDC, CTIA, ATS
"Everything should be made as simple as possible, and no simpler."