Implementing Fisher-Yates shuffling algorithm

  • 10 favourites

Index

Stats

2,567 visits, 6,730 views

Translations

This tutorial hasn't been translated.

Tools

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

  • 0 Comments

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