# Random menus

**URL:** <https://forum.makecode.com/t/random-menus/41602>\
**Category:** Help\
**Created:** [January 20, 2026, 1:43am UTC](https://forum.makecode.com/t/random-menus/41602 "2026-01-20T01:43:28Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![YamJam](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/yamjam/32/29681_2.png) [@YamJam](https://forum.makecode.com/u/YamJam)\
**Post date:** [January 20, 2026, 1:43am UTC](https://forum.makecode.com/t/random-menus/41602/1 "2026-01-20T01:43:28Z")

</div>

Does anybody know how to make a menu have random options? I’m making a game and part of it needs to have a menu that has random options in it that the code chose from an array or something. (thats how I think it should work)

---

<div class="post-metadata">

**Author:** ![TheEarth](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/theearth/32/34579_2.png) [@TheEarth](https://forum.makecode.com/u/TheEarth)\
**Post date:** [January 20, 2026, 4:52am UTC](https://forum.makecode.com/t/random-menus/41602/2 "2026-01-20T04:52:07Z")

</div>

here you go its simple enough for you to understand how it works

> **[demo](https://arcade.makecode.com/S39602-30202-61711-30712)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

---

<div class="post-metadata">

**Author:** ![Peau12](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/peau12/32/29299_2.png) [@Peau12](https://forum.makecode.com/u/Peau12)\
**Post date:** [January 20, 2026, 4:56am UTC](https://forum.makecode.com/t/random-menus/41602/3 "2026-01-20T04:56:43Z")

</div>

Make an array, put values, and… I’ll show ya!

> **[Untitled](https://arcade.makecode.com/S63002-13571-96499-80777)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

 ![arcade-screenshot (14)](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/9/2/92a061c5978926b12174035dc3a272f25153b31d.png)

---

<div class="post-metadata">

**Author:** ![redSprite](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/redsprite/32/34262_2.png) [@redSprite](https://forum.makecode.com/u/redSprite)\
**Post date:** [January 20, 2026, 4:58am UTC](https://forum.makecode.com/t/random-menus/41602/4 "2026-01-20T04:58:49Z")

</div>

```auto
function createSmallerRandomArray (menuItems: any[], itemCount: number, repeat: boolean) {
    let temporaryArray = menuItems
    let returnedArray = []
    for (let index = 0; index < itemCount; index++) {
        if (temporaryArray.length <= 0) {
            break;
        } else {
            let randomNum = randint(0, temporaryArray.length - 1)
            returnedArray.push(temporaryArray[randomNum])
            if (!(repeat)) {
                temporaryArray.removeAt(randomNum)
            }
        }
    }
    return returnedArray
}

```

Here’s a function I created for you! It’s customizable by a bit might I add.  
For it to work you must install the

```auto
riknoll/arcade-mini-menu

```

extension.

Here’s an example:

> **[custom-function-project](https://arcade.makecode.com/S77197-42849-15857-88126)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

---

<div class="post-metadata">

**Author:** ![YamJam](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/yamjam/32/29681_2.png) [@YamJam](https://forum.makecode.com/u/YamJam)\
**Post date:** [January 20, 2026, 5:07am UTC](https://forum.makecode.com/t/random-menus/41602/5 "2026-01-20T05:07:29Z")

</div>

thats strange, i copied the exact code and i got an error

 ![Screenshot 2026-01-19 210343](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/0/8/080a2c1061230d5bfa4ae174c1fac4e68d902371.png)

this is happening and idk why since I copied straight from @TheEarth s code

---

<div class="post-metadata">

**Author:** ![TheEarth](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/theearth/32/34579_2.png) [@TheEarth](https://forum.makecode.com/u/TheEarth)\
**Post date:** [January 21, 2026, 12:13am UTC](https://forum.makecode.com/t/random-menus/41602/6 "2026-01-21T00:13:37Z")

</div>

remove the big green thing that says create menu sprite from

---

<div class="post-metadata">

**Author:** ![YamJam](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/yamjam/32/29681_2.png) [@YamJam](https://forum.makecode.com/u/YamJam)\
**Post date:** [January 21, 2026, 3:35am UTC](https://forum.makecode.com/t/random-menus/41602/7 "2026-01-21T03:35:25Z")

</div>

Thanks! It worked!
