Top "Shuffle" questions

Shuffling is the act of randomizing the order of the elements in a collection.

Shuffle a numpy array

I have a 2-d numpy array that I would like to shuffle. Is the best way to reshape it to 1…

python random numpy shuffle
What’s the best way to shuffle an array in Perl?

So I have a file. Let’s say it looks like this (it's actually longer): 1234 2134 3124 4123 What is the best way …

perl random shuffle
How to use Java Collections.shuffle() on a Scala array?

I have an array that I want to permutate randomly. In Java, there is a method Collections.shuffle() that can …

arrays scala collections shuffle scala-collections
Behavior of shuffle on Set vs List using scala.util.Random

scala> Random.shuffle((1 to 10).toSet) res10: scala.collection.immutable.Set[Int] = Set(5, 10, 1, 6, 9, 2, 7, 3, 8, 4) scala> Random.shuffle((1 to 10).toSet) res11: …

list scala random set shuffle
How to implement a repeating shuffle that's random - but not too random

I've got a list of n items. I want an algorithm to let me pick a potentially infinite sequence of …

algorithm random shuffle
Is this C implementation of Fisher-Yates shuffle correct?

Here's a C implementation of Fisher-Yates that I want to use in a deck-shuffling routine. Am I doing this correctly (…

c shuffle
why does this simple shuffle algorithm produce biased results? what is a simple reason?

it seems that this simple shuffle algorithm will produce biased results: # suppose $arr is filled with 1 to 52 for ($i < 0; $…

algorithm math shuffle
Python - shuffle only some elements of a list

I'm trying to shuffle only elements of a list on 3rd till last position so the 1st two will always …

python list random elements shuffle
How random is PHP's shuffle function?

Does anyone know what's the randomness of PHP's shuffle() function? Does it depend on the operating system? Does it use …

php random shuffle
Scala ListBuffer (or equivalent) shuffle

Is there a simple shuffle function for Scala lists? If not, whats the simplest way to implement? I have a …

arrays list scala shuffle