Random sound

I’m a beginner and I’m trying to make a button playing sound randomly each time you press it :
I’ve imported 10 sounds, and i want to play randomly 1 sound from 5 sounds I define from the 10 of the library…each time i press on the button.

pleeeeeeeeaaaz help !:frowning:

It’s me again :wink:

I’ve try that for only 2 sounds and it looks like it works!

on (release) {
if (random (2)<1) {
} else {
son2.start(0,1 );

it’s my first try so please understand my …weakness on this and be sure i’m open to any advice!!

You might like to try …

Export your 10 sounds with the linkage:
s11, s12, s13, … s20

When you want a sound use

randomSound=new Sound();

or, if you want to give your sounds descriptive names …

Export your 10 sounds with the linkage:
ding, ping, crash …

When you want a sound use

soundList= new Array (“ding”,“ping”,“crash”, “boom”)
randomSound=new Sound ()