With the help of d3.shuffle() method, we can get the randomly shuffled array of values from the source array by using Fisher–Yates shuffle algorithm and return a single array.
d3.shuffle(array[, start[, stop]])
Return value: It returns a single array having values from the source array.
Note: To execute the below examples you have to install the d3 library by using the command prompt for the following command.
npm install d3
Example 1: In this example we can see that by using d3.shuffle() method, we are able to get the shuffled array from the source array using Fisher-Yates shuffle algorithm and return the single array.
[ 1, 5, 6, 3, 4, 2 ]
[ 'B', 'C', 'A' ]