Implementing Fisher-Yates shuffling algorithm

  • 12 favourites



5,717 visits, 13,292 views



This tutorial hasn't been translated.


This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.

Edit: I updated the tutorial. You can check Online example and download capx file.

kittiewan has a similar technique for shuffling, but i used a more common technique called Fisher-Yates shuffling. I used only 2 text objects to use the concept. But it can be easily used with sprites. If you are an experienced user you can skip to the last page for general event view.

Layout Part

Insert a Text object and name it BeforeText.

Don't forget: If you want to use lots of numbers, you will need a bigger text area. Insert another Text object and name it AfterText. Also you can change default Text in properties

Insert an array. Default size of an array is 10, but we will change it in events.

Event sheet part

Add an global variable to events area for keeping the total number of values.

Add another variable to use in a loop


  • Order by
Want to leave a comment? Login or Register an account!