This function uses Fisher-Yates shuffle. It just generate a set of numbers in random order that are not repeated.
This can also found in hercules github.
Examples:
F_ShuffleNumbers( 0, 5, .@output); // possible output 4,1,3,2,0,5
F_ShuffleNumbers( -5, 1, .@output); // possible output -3,-5,-4,-2,-1,1,0
F_ShuffleNumbers( 0, 100, .@output, 5); // possible output 9,55,27,84,33
Reminder: Use *freeloop command when appropriate !
Snippet:
I have used them in ...
1. outdated - reshuffle player's registration before entering battleground (recent topic - script)
2. randomize the woe time (script)
3. shuffle the portal location, make it like a maze event (outdated script)
External Links:
Question asked on the forumHow me and Haru optimize and perfect this function
meko's Array manipulation functions
Shuffle Algorithm topic
No comments:
Post a Comment