Skip to content

Instantly share code, notes, and snippets.

View heygleeson's full-sized avatar

Andrew Gleeson heygleeson

View GitHub Profile
@heygleeson
heygleeson / array_shuffle.gml
Last active September 26, 2023 20:01
array_shuffle() for GameMaker Studio 2.3.1
// Adds to GMS2.3.1's new "array_" functions.
// Based of Fisher-Yates Shuffle https://bost.ocks.org/mike/shuffle/
function array_shuffle(_array) {
var _len = array_length(_array), _last = 0, _i = 0;
while(_len) {
_i = irandom(--_len);
_last = _array[_len];
_array[_len] = _array[_i];
_array[_i] = _last;
}