# Help with random generation for match 3 game

**URL:** <https://forum.defold.com/t/help-with-random-generation-for-match-3-game/83486>\
**Category:** Questions\
**Created:** [November 9, 2026, 8:43pm UTC](https://forum.defold.com/t/help-with-random-generation-for-match-3-game/83486 "2026-11-09T20:43:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jay\_Cee](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/jay_cee/32/34527_2.png) [@Jay\_Cee](https://forum.defold.com/u/Jay_Cee)\
**Post date:** [November 9, 2026, 8:43pm UTC](https://forum.defold.com/t/help-with-random-generation-for-match-3-game/83486/1 "2026-11-09T20:43:39Z")

</div>

I have been working on the cascading mechanics for my match 3 game and have settled on a standard linear drop as opposed to a delayed, EASING\_INQUAD drop. Anyway, my issue is finding a balanced spawn system that does not generate so many of a single color instance. (Video attached)

My hope is there is a Match 3 pro among us that can assist a lowly dev. Right now I use a standard `math.random()`call. I googled and got an idea to use a buffered approach.

This would be a linear (or 2D) buffer of randomized tiles that are then run thru a `Fisher-Yates shuffle` and then each spawner plucks from the list upon request. The issue with this approach is my game has multiple spawners and some will use different spawned object list. I suppose I would have to create multiple list.

for example:

```lua
spawners =
	{
		{
			id = 0,
			{ spawn = "BLUE", probability = 1, board_max = 0, spawn_max = 0 },
			{ spawn = "GREEN", probability = 1, board_max = 0, spawn_max = 0 },
			{ spawn = "YELLOW", probability = 1, board_max = 0, spawn_max = 0 },
			{ spawn = "RED", probability = 1, board_max = 0, spawn_max = 0 }
		},
		{
			id = 1,
			{ spawn = "COIN", probability = 4, board_max = 0, spawn_max = 0 },
            { spawn = "BLUE", probability = 1, board_max = 0, spawn_max = 0 },
			{ spawn = "RED", probability = 1, board_max = 0, spawn_max = 0 }
		}
	}

```

Thanks for listening. Any advice would be greatly appreciated.
