When I was testing the new randomizer on my phone yesterday the performance was very poor. I tracked it down to be the 'handleSetItem' function causing the slowdown. It was being called anytime a new value was flicked through which is, as far as I understand it, unnecessary because we only care about the last value. So I fixed that and it runs a lot smoother on phone or desktop.
I also simplified the logic by removing recursion which was elegant in the beginning but got cluttered pretty quick .
And finally I added some tests to make it more robust.
When I was testing the new randomizer on my phone yesterday the performance was very poor. I tracked it down to be the 'handleSetItem' function causing the slowdown. It was being called anytime a new value was flicked through which is, as far as I understand it, unnecessary because we only care about the last value. So I fixed that and it runs a lot smoother on phone or desktop.
I also simplified the logic by removing recursion which was elegant in the beginning but got cluttered pretty quick .
And finally I added some tests to make it more robust.