mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-01-11 10:39:56 -05:00
fix: Equalise the chances when picking a random backdrop
This commit is contained in:
parent
a86dc5bb58
commit
b29f07636d
1 changed files with 1 additions and 1 deletions
|
@ -408,7 +408,7 @@ class Scratch3LooksBlocks {
|
||||||
const numCostumes = stage.getCostumes().length;
|
const numCostumes = stage.getCostumes().length;
|
||||||
if (numCostumes > 1) {
|
if (numCostumes > 1) {
|
||||||
let selectedIndex = Math.floor(Math.random() * (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);
|
stage.setCostume(selectedIndex);
|
||||||
}
|
}
|
||||||
// Try to cast the string to a number (and treat it as a costume index)
|
// Try to cast the string to a number (and treat it as a costume index)
|
||||||
|
|
Loading…
Reference in a new issue