Skip to content

Instantly share code, notes, and snippets.

@Sreyas-Sreelal
Last active June 26, 2018 02:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Sreyas-Sreelal/8cc536f232874eb83488b8f1e56a1606 to your computer and use it in GitHub Desktop.
Save Sreyas-Sreelal/8cc536f232874eb83488b8f1e56a1606 to your computer and use it in GitHub Desktop.
Second version of Shuffle Array
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