void setup() {
// Initiate the pseudo-random number generator
randomSeed(analogRead(0));
}
void loop() {
// Generate random pitch & duration
int pitch = random(30, 5000);
int duration = 1000 / (random(1000) + 1);
//int pitch = 8000; //fixed freq
// int duration = 20;
// Play a tone to the digital pin PWM number 8
tone(8, pitch, duration);
// Make a pause
delay(duration * 1.30);
// Stop the tone playing
noTone(8);
}