pokemon-showdown/test/simulator/misc
Matthew Glazar 6c2350f5b6 Refactor random indexes into sample function
Often, you just need a random item in an array. Throughout Pokemon
Showdown's code, there are many instances of the following pattern:

    let randomThing = things[this.random(things.length)];

Make this code easier to read by factoring the indexing into the
PRNG#sample function:

    let randomThing = this.sample(things);

Run the following sed script to refactor lots of code to use sample:

    s/\([a-zA-Z0-9.]\{1,\}\)\[this\.random(\1\.length)\]/this.sample(\1)/

This commit should not change behaviour. In particular, PRNG#next is
called the same number of times with the same number of parameter as
before this commit, and PRNG#next's results are interpreted in the same
way as before this commit.
2018-03-12 05:53:33 +09:00
..
arceus.js Cache species-specific effects (e.g. Arceus); 20% overall perf win (#4459) 2018-03-05 17:24:14 +09:00
choice-parser.js Fix getChoice 2018-01-29 20:59:52 -06:00
decisions.js Fix getChoice 2018-01-29 20:59:52 -06:00
dex.js Refactor simulator into new sim/ directory 2017-05-05 16:48:38 -05:00
eventemitter.js Make eslint rules stricter 2017-10-08 04:41:11 -05:00
faint-order.js Test faint order 2017-12-01 13:06:01 -06:00
inversebattle.js Make Inverse Battle test work without a format 2017-12-01 23:11:31 +08:00
megaevolution.js Fix certain Abilities not being overwritten by most forme changes (#4245) 2017-12-14 11:45:12 -05:00
mixandmega.js Fix certain Abilities not being overwritten by most forme changes (#4245) 2017-12-14 11:45:12 -05:00
prng.js Refactor random indexes into sample function 2018-03-12 05:53:33 +09:00
random-teams.js Tests: Fix typo 2018-03-02 14:32:28 +00:00
statuses.js Use PRNG in sim/ files (#4365) 2018-01-24 12:27:07 -06:00
statusmoves.js Rename Battle#on to Battle#onEvent 2017-05-05 16:48:38 -05:00
trapmoves.js Refactor old gens to for...of (#4274) 2017-12-23 21:46:04 -06:00
turn-order.js Implement Ultra Burst 2017-11-17 00:01:09 -06:00
typechange.js Test: Use the new common#createBattle method 2016-06-17 05:45:22 -05:00
weather.js Fix Hail/Sandstorm damage regression 2017-05-18 06:29:25 -05:00
weight.js Rename Battle#on to Battle#onEvent 2017-05-05 16:48:38 -05:00