Setting a boolean to a range of switches?

So I have 60 switches I need to set randomly to on or off. Is there a way to do this all at once, or will I need to do each one individually?
Given a Switch ID A (e.g. 2) and a Switch ID B (e.g. 74), this script will set all switches in this range( including 74) to either true or false.

Code:
for (let id = 2; id <= 74; id++) {
    $gameSwitches.setValue(id, Math.random() < 0.5);
}
Given a Switch ID A (e.g. 2) and a Switch ID B (e.g. 74), this script will set all switches in this range( including 74) to either true or false.

Code:
for (let id = 2; id <= 74; id++) {
    $gameSwitches.setValue(id, Math.random() < 0.5);
}
Ah thanks! Appreciate it! ^ ^

Original thread: https://forums.rpgmakerweb.com/threads/setting-a-boolean-to-a-range-of-switches.134956/