Khan/khan-exercises — pull request #132934 by Merbs (2013-12-04 16:08:02+00:00)
Title: Going Bagless: changing out problemBag

The problemBag is confusing (with respect to multiple problems being loaded), because it seems as though it is reloaded each time, making each draw random (with replacement) rather than shuffled (without replacement). If it’s not really important to be precise with the weighting (that of of 10 draws, something with probability .30 is chosen exactly three times), then the following suffices:
```
problem = problems.eq(Math.floor(Math.random() * typeIndex.length));
```
Otherwise, a ‘jostler’ can substitute for the shuffle, preventing it from going in the sequential order except when the weightSum is a multiple of three. There probably are some slight improvements that could be made, because when there are only two equally weighted exercises, they alternate every time. One idea is to duplicate the array if it is below some minimum length and than shuffle according to a seed (so that it is deterministic). But it’s not clear to me that this differs drastically from actual randomness.

If someone could explain what determines the data that comes from `readyForNextProblem` to me, I'd really appreciate it.

Incompatible with:
- data-weight=“0” (https://github.com/Khan/khan-exercises/commit/ece572aa0a283b5de3149750aeaf0306bf1b16e0)
- data-weight=“0.6” (permutations_1, permutations_and_combinations_2)