Search
 
SCRIPT & CODE EXAMPLE
 

CPP

Fisher–Yates shuffle Algorithm c++

default_random_engine seed;
vector<int> shuffle(vector<int>arr) {
        
        for(int i =arr.size()-1 ;i>0;i--)
        {       
                int indx =  uniform_int_distribution<int>(0, i)(seed);
                swap(arr[i],arr[indx]);
                
        }
        return arr;
    }
Comment

PREVIOUS NEXT
Code Example
Cpp :: how to input in cpp 
Cpp :: stack class implementation to file unix-style in c++ 
Cpp :: changing values of mat in opencv c++ 
Cpp :: int max in c++ 
Cpp :: how creat matrix column in c++ 
Cpp :: c++ std string to float 
Cpp :: Translation codeforces in c++ 
Cpp :: prevent copy c++ 
Cpp :: how to convert hexadecimal to decimal in c++ 
Cpp :: resharper fold if statement 
Cpp :: makefile for single cpp file 
Cpp :: c++ recorrer string 
Cpp :: what is the default include path in ubuntu c++ 
Cpp :: Operators in C / C++ 
Cpp :: c++ cin 
Cpp :: c++ compare type 
Cpp :: iomanip header file in c++ 
Cpp :: how to print an array in cpp in single line 
Cpp :: int to string C++ Using stringstream class 
Cpp :: compare function in c++ 
Cpp :: create vector of specific size c++ 
Cpp :: stack data structure c++ 
Cpp :: not c++ 
Cpp :: file streams in c++ 
Cpp :: cout in c++ 
Cpp :: cpp serial print override always in same place 
Cpp :: prefix using stack 
Cpp :: Vaccine Dates codechef solution in c++ 
Cpp :: remove a element from an array c++ 
Cpp :: kruskal algorithm 
ADD CONTENT
Topic
Content
Source link
Name
7+8 =