Use the randBool function in public mod code.
Change this function that it takes 1 argument which is the chance on true. We have a Bernoulli distribution now.
Also one forgotten instance of pickRandom is added in this patch.
refs D121
Differential D235
randBool changes from randomPatch bb on Mar 18 2017, 5:48 PM. Authored by
Details
Use the randBool function in public mod code. Also one forgotten instance of pickRandom is added in this patch. refs D121 Load changed random maps in atlas. Notice that the changes are logicically equivalent to the previous code.
Diff Detail
Event TimelineComment Actions 0.5 should be the default IMO. In general its good to avoid default values, but here we only have one value and the average use of the function will be 0.5. If coders are not aware of the argument, they wil llikely mean right that value, no? Comment Actions Build is green Updating workspaces. Build (release)... Build (debug)... Running release tests... Running cxxtest tests (305 tests).................................................................................................................................................................................................................................................................................................................OK! Running debug tests... Running cxxtest tests (305 tests).................................................................................................................................................................................................................................................................................................................OK! http://jw:8080/job/phabricator/542/ for more details. Comment Actions Build is green Updating workspaces. Build (release)... Build (debug)... Running release tests... Running cxxtest tests (305 tests).................................................................................................................................................................................................................................................................................................................OK! Running debug tests... Running cxxtest tests (305 tests).................................................................................................................................................................................................................................................................................................................OK! http://jw:8080/job/phabricator/545/ for more details. Comment Actions Have to admit, it's really a bit shorter and less thinking work with the randBool notation for non-0.5 probabilities, not bad. Very few TODOs, mostly change 0.33 to 1/3 and 0.66 to 2/3 IMO, dunno if there are more occurances. going to continue review then
Comment Actions Also those changed lines in the unknown*js files should rename mdd1 mdd2 to vertical, horizontal or similar descriptive names (also I was taught in school to avoid the negation in if (!foo) statement1; else statement2; patterns) Comment Actions Fixing comments above. Nuking some mdd* variables in unknown*.js also inverting some cases. Changed maps are tested in Atlas Comment Actions Build is green Updating workspaces. Build (release)... Build (debug)... Running release tests... Running cxxtest tests (305 tests).................................................................................................................................................................................................................................................................................................................OK! Running debug tests... Running cxxtest tests (305 tests).................................................................................................................................................................................................................................................................................................................OK! http://jw:8080/job/phabricator/574/ for more details. Comment Actions The patch is correct and I agree that it is better to have a unifom use of randBool than sometimes using randFloat() > foo, randFloat() < foo, randInt(x,y) > z and more variations. Thanks for the patch and splitting this from D121. There can't be too many parts of that remaining :D
|