p5.js | shuffle() function
The shuffle() function in p5.js is used to shuffle the order of given array elements.
Parameters: This function accepts a parameter Array whose elements are to be shuffled.
Return Value: It returns the shuffled array.
Below program illustrates the shuffle() function in p5.js:
NOTE: In the above codes, draw() function has not been used because if we use draw function then it does not give a clear output i.e, it keeps on changing the order of the array string continually and not giving any stagnant result.