Software suppliers are trying to make their software packages more ‘user-friendly’… Their best approach so far has been to take all the old brochures and stamp the words ‘user-friendly’ on the cover. Bill Gates

Shuffle a given array

Language Java | Level Intermediate | Category Algorithms | August 5, 2015 9:18 am


Algorithm Problem Description

Fisher–Yates shuffle is an algorithm for generating a random set. The Fisher–Yates shuffle is quite efficient. Shuffling an array randomizes its element order.

Write a program to randomly shuffle the Array.

Output

          	        
          	        

Original array of items: [1, 2, 3, 4, 5, 6, 16, 15, 14, 13, 12, 11]
After Fisher–Yates shuffle array of items: [6, 11, 15, 2, 5, 4, 3, 13, 16, 12, 1, 14]

          	        
          	        				    


Comments



Please login to add comments.