From b29f07636d4dc713b5a6012791438ad44d4c79a4 Mon Sep 17 00:00:00 2001 From: Joke Book Date: Wed, 20 Feb 2019 21:11:27 +0000 Subject: [PATCH] fix: Equalise the chances when picking a random backdrop --- src/blocks/scratch3_looks.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/blocks/scratch3_looks.js b/src/blocks/scratch3_looks.js index 94d70ea5b..e04df7b00 100644 --- a/src/blocks/scratch3_looks.js +++ b/src/blocks/scratch3_looks.js @@ -408,7 +408,7 @@ class Scratch3LooksBlocks { const numCostumes = stage.getCostumes().length; if (numCostumes > 1) { let selectedIndex = Math.floor(Math.random() * (numCostumes - 1)); - if (selectedIndex === stage.currentCostume) selectedIndex += 1; + if (selectedIndex === stage.currentCostume) selectedIndex = numCostumes - 1; stage.setCostume(selectedIndex); } // Try to cast the string to a number (and treat it as a costume index)