Maximal Length of List to Shuffle with Python random.shuffle?

TL;DR: It “breaks” on lists with over 2080 elements, but don’t worry too much 🙂 Complete answer: First of all, notice that “shuffling” a list can be understood (conceptually) as generating all possible permutations of the elements of the lists, and picking one of these permutations at random. Then, you must remember that all self-contained … Read more

Numpy shuffle multidimensional array by row only, keep column order unchanged

You can use numpy.random.shuffle(). This function only shuffles the array along the first axis of a multi-dimensional array. The order of sub-arrays is changed but their contents remains the same. In [2]: import numpy as np In [3]: In [3]: X = np.random.random((6, 2)) In [4]: X Out[4]: array([[0.71935047, 0.25796155], [0.4621708 , 0.55140423], [0.22605866, 0.61581771], … Read more

shuffle array in ng-repeat angular

Thx to http://bost.ocks.org/mike/shuffle/ use this shuffling function: Speciality with it is, that the input array stays bindable because the shuffling wont create a new array but instead does the shuffling on the same reference. // -> Fisher–Yates shuffle algorithm var shuffleArray = function(array) { var m = array.length, t, i; // While there remain elements … Read more

How random is PHP’s shuffle function?

shuffle() function is based on the same generator as rand(), which is the system generator based on linear congruential algorithm. This is a fast generator, but with more or less randomness. Since PHP 4.2.0, the random generator is seeded automatically, but you can use srand() function to seed it if you want. mtrand() is based … Read more