MZ JS. Trying to Play a Random Sound Effect

The Goal is I'm trying to select a chess piece to make it play one or the other sound effect. this is the current code. but it plays BOTH at once. it even ignores the math statement..
rpg maker help.JPG


But it plays BOTH at once.

I tried looking at the other pages about this, including adding in "". but I didn't get anywhere

I figured it out. By accident... I hope this helps others trying to do the same. idk if there is a more efficient process
yessss.JPG
The Goal is I'm trying to select a chess piece to make it play one or the other sound effect. this is the current code. but it plays BOTH at once. it even ignores the math statement..
View attachment 323429

But it plays BOTH at once.

I tried looking at the other pages about this, including adding in "". but I didn't get anywhere

I figured it out. By accident... I hope this helps others trying to do the same
View attachment 323470
Since you know you only have two sounds and you want it to choose randomly, try this:
JavaScript:
const fig = this._config;
const rdmVal = [fig.PawnSSEffect, fig.BishopSSEffect][Math.randomInt(2)];
playSoundEffect(rdmVal, fig.moveSoundVolume, fig.moveSoundPitch);

Original thread: https://forums.rpgmakerweb.com/threads/js-trying-to-play-a-random-sound-effect.173355/