Create an algorithm


Write an algorithm :

Given an array of integers,in-place shuffle it,the algorithm should produce an unbiased permutation i.e. every permutation is equally likely


void swapElement(int* a,int i,int j){
int x=*(a+i);
*(a+i)= *(a+j);
*(a+j)= x;
void rand_arr(int *arr,int n)
for(int i=n-1;i>0;i–){

This algorithm selects the last element of the array, swaps it with a random element of the array, and then repeat the same process with the array without the last element.