In this simple example a sound will play when the number is 5. You can modify the minimum and maximum numbers to randomize with the first action.
You can also modify it in a number of ways, for instance if you use a big range to randomize, you can keep decreasing the maximum range as time passes so the chance to play the sound will keep increasing with time.