How does a project get to be a year late?... One day at a time. Fred Brooks

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.