Made a slight change to the way it randomly picks elements in the hopes that it'll be faster. Wasn't able to test the code, it's probably buggy.