# How do i randomize screens with no repeats?

**URL:** <https://forum.code.org/t/how-do-i-randomize-screens-with-no-repeats/40451>\
**Category:** Uncategorized\
**Created:** [February 22, 2025, 11:12am UTC](https://forum.code.org/t/how-do-i-randomize-screens-with-no-repeats/40451 "2025-02-22T11:12:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![trixijonhs678](https://avatars.discourse-cdn.com/v4/letter/t/4491bb/32.png) [@trixijonhs678](https://forum.code.org/u/trixijonhs678)\
**Post date:** [February 22, 2025, 11:12am UTC](https://forum.code.org/t/how-do-i-randomize-screens-with-no-repeats/40451/1 "2025-02-22T11:12:00Z")

</div>

How do i randomise screens without repeats?

---

<div class="post-metadata">

**Author:** ![varrience](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/varrience/32/8042_2.png) [@varrience](https://forum.code.org/u/varrience)\
**Post date:** [February 23, 2025, 1:47pm UTC](https://forum.code.org/t/how-do-i-randomize-screens-with-no-repeats/40451/2 "2025-02-23T13:47:34Z")

</div>

best way of doing it is stetting up an array with the listed screens, when a specific index of a screen is picked use `Array.splice` to remove it and then continue picking

```auto
var screens = ["screen1", "screen2", "screen3"];
function pickScreen() {
var index = randomNumber(0, screens.length - 1);
setScreen(screens[index]);
screens.splice(index, 1);
}

```

this should be the easiest solution i could come up with offhand
