Last active
July 11, 2021 05:51
-
-
Save Sreyas-Sreelal/5481423046e0138d18d02e44e1e62363 to your computer and use it in GitHub Desktop.
A pawn function to shuffle arrays
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 | |
for( new rand_index = random( end - start + 1 ) + start, i = start; i < end; ++i , rand_index = random( end - start + 1 ) + start ) | |
array[ i ] = array[ rand_index ] + array[ i ] - ( array[ rand_index ] = array[ i ] ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment