Last active
June 26, 2018 02:37
-
-
Save Sreyas-Sreelal/8cc536f232874eb83488b8f1e56a1606 to your computer and use it in GitHub Desktop.
Second version of Shuffle Array
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ShuffleArray( array[ ] , start = 0 , end = sizeof( array ) )//by Sreyas | |
{ | |
new rand_index , i , difference,temp; | |
i = start, | |
difference = end - start + 1; | |
while(i < end) | |
rand_index = random( difference ) + start , temp = array[ i ],array[ i ] = array[ rand_index ],array[ rand_index ] = temp,++i; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment