pokemon-showdown/test
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
..
application Fix chainbreeding validator 2018-02-01 21:06:37 -06:00
chat-plugins
simulator Refactor random indexes into sample function 2018-03-12 05:53:33 +09:00
.eslintrc
assert.js
common.js Refactor battle stream system 2018-01-28 21:06:49 -06:00
main.js Tests: Improve error message for Promise rejections 2018-01-31 21:53:10 -06:00
mocha.opts Remove validate-conditionals eslint rule 2018-01-19 13:25:10 -06:00