class Study { String name, gender, obj, unit, noun, relation; float muo, sd, mean; int digit, samplesize, k, known; // Constructor Study() { // Person String[] names = { "Neo", "Jake", "Mr. Anderson", "Lisa Simpson", "Bart Simpson", "Homer Simpson", "Ted Mosby", "Robin Scherbatsky", "Roger", "Rachel", "Carol", "Samantha", "Nathan", "Morpheus" }; String[] genders = { "he", "he", "he", "she", "he", "he", "he", "she", "he", "she", "she", "she", "he", "he" }; int i = int(random(names.length)); name = names[i]; gender = genders[i]; // Object String[] objs = { "male height", "female height", "male weight", "female weight", "cat length", "male salary", "cat speed", "dog weight" }; String[] units = { "ft", "ft", "pounds", "pounds", "inches", "dollars", "mi/hr", "pounds" }; String[] nouns = { "males", "females", "males", "females", "cats", "males", "cats", "dogs" }; int[] digits = { 1, 1, 3, 3, 2, 5, 2, 2 }; i = int(random(objs.length)); obj = objs[i]; unit = units[i]; noun = nouns[i]; digit = digits[i]; // Limit float[] lowers = { 5.5, 5, 150, 100, 15, 40000, 20, 40 }; float[] uppers = { 6.5, 6, 200, 150, 20, 60000, 30, 70 }; float lower = lowers[i]; float upper = uppers[i]; // Sample size int[] samplesizes = { 10, 20, 50, 100, 1000 }; samplesize = samplesizes[int(random(samplesizes.length))]; // Relation and Known Variance String[] relations= { "greater than", "less than", "different from" }; k = int(random(relations.length)); relation = relations[k]; known = int(random(2)); // Data muo = random(lower, upper); sd = random(lower/10, upper/10); muo = float(int(muo*100))/100; sd = float(int(sd*100))/100; if (k == 0) { mean = random(muo, (upper+muo)/2); } else if (k == 1) { mean = random((lower+muo)/2, muo); } else { mean = random((lower+muo)/2, (upper+muo)/2); } mean = float(int(mean*100))/100; } }