# All Questions

430909 views

### How to randomize (shuffle) a JavaScript array?

I have an array like this: var arr1 = ["a", "b", "c", "d"]; How can I randomize / shuffle it?
306866 views

### Random shuffling of an array

I need to randomly shuffle the following Array: int[] solutionArray = {1, 2, 3, 4, 5, 6, 6, 5, 4, 3, 2, 1}; Is there any function to do that?
72327 views

### What's the Best Way to Shuffle an NSMutableArray?

If you have an NSMutableArray, how do you shuffle the elements randomly? (I have my own answer for this, which is posted below, but I'm new to Cocoa and I'm interested to know if there is a better wa...
35404 views

### Is using Random and OrderBy a good shuffle algorithm?

I have read an article about various shuffle algorithms over at Coding Horror. I have seen that somewhere people have done this to shuffle a list: var r = new Random(); var shuffled = ordered.OrderBy...
46039 views

### Is it correct to use JavaScript Array.sort() method for shuffling?

I was helping somebody out with his JavaScript code and my eyes were caught by a section that looked like that: function randOrd(){ return (Math.round(Math.random())-0.5); } coords.sort(randOrd); a...
512071 views

### Shuffling a list of objects

I have a list of objects in Python and I want to shuffle them. I thought I could use the random.shuffle method, but this seems to fail when the list is of objects. Is there a method for shuffling obje...
62727 views

### Most efficient way to randomly "sort" (Shuffle) a list of integers in C#

I need to randomly 'sort' a list of integers (0-1999) in the most efficient way possible. Any ideas? Currently, I am doing something like this: bool[] bIndexSet = new bool[iItemCount]; for (int iC...
39496 views

### Card Shuffling in C#

I am trying to write a code for a project that lists the contents of a deck of cards, asks how much times the person wants to shuffle the deck, and then shuffles them. It has to use a method to create...