ruby-on-rails-3

How can I recreate Ruby's sort_by {rand} in python?

How can I recreate Ruby's sort_by {rand} in python? Question: I have a line of code where can sort an array into random order: someArray.sort_by {rand} so in python, how can I convert to it to python code? Asked By: hanan || Source Answers: Maybe you are looking for this: import random l = [1, …

Total answers: 2