How can I make random sound effects

BlitzMax Forums/BlitzMax Beginners Area/How can I make random sound effects

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Something like:
Global AmbientSounds:TSound[10]
...
For a = 0 until TotalAmbientSounds
  AmbientSound[a] = Loadsound("snd\amb" + a + ".wav")
Next
...
if (Millisecs() - AmbientStartTime) > AmbientInterval
  playsound AmbientSound[rand(1, TotalAmbientSounds) - 1]
  AmbientInterval = rand(AmbientIntervalMin, AmbientIntervalMax)
  AmbientStartTime = Millisecs()
End if
...
Should do the trick.