}
// Pick a random sound from the buffer and play it into system
-void sfx_set_playrnd( sfx_set_t *source, sfx_system_t *sys )
+void sfx_set_playrnd( sfx_set_t *source, sfx_system_t *sys, int min_id, int max_id )
{
if( !source->numsegments )
{
return;
}
- int pick = rand() % source->numsegments;
-
+ int pick = (rand() % (max_id-min_id)) + min_id;
+
sys->source = source->main;
sys->cur = source->segments[ pick*2 + 0 ];
sys->end = source->segments[ pick*2 + 1 ];