Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

PRNGs for GameMaker

Custom pseudorandom number generators for GameMaker! · By YellowAfterlife

array_shuffle DIY

A topic by Dale Turner created 22 days ago Views: 53 Replies: 1
Viewing posts 1 to 2
(1 edit)

Thanks for making this. I'm currently integrating it in to my project and I was wondering if this is an acceptable way of mimicking array_shuffle:


Basically just moving the entries one by one at a random index. Might be a stupid question, because it's functioning fine, but this is just a tricky topic and I don't want an implementation that could skew results or cause performance issues. 

Developer

More or less!

You can check the shuffle in HTML5 runtime source as a point of reference - it’s not unlike yours, but swaps elements instead of using array_push+delete and traverses back to front so that it can’t swap the same thing multiple times.