Fix shuffle to work with objects too

Fixes the shuffle function after it was broken (stopped working with objects) by changing the method to add a limit.