# Shuffle doesn't work ingame

**URL:** https://qa.fmod.com/t/shuffle-doesnt-work-ingame/11878
**Category:** FMOD Studio
**Created:** [April 8, 2015, 8:41pm UTC](https://qa.fmod.com/t/shuffle-doesnt-work-ingame/11878 "2015-04-08T20:41:06Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![G-man](https://avatars.discourse-cdn.com/v4/letter/g/76d3ee/32.png) [@G-man](https://qa.fmod.com/u/G-man)
#### Post date: [April 8, 2015, 8:41pm UTC](https://qa.fmod.com/t/shuffle-doesnt-work-ingame/11878/1 "2015-04-08T20:41:06Z")

</div>

Hi

A while back I made a quite basic system with three songs in a multi sound playlist, every time the game starts up one of them is selected at random and it worked just as planned ingame. But now for some reason it doesn’t work that way anymore. When i preview the event in Fmod Studio it works as it should but when I try it ingame the first song in the playlist is always selected first.

I’ve tried using different play percentages, switching the dice button on and off, changing the sound module to scattered and so on but nothing seems to change anything (except if I change the order of the sounds of course). Finally I tried putting the sounds on the timeline and using three transitions with a probability of 30% each. It worked perfect in Fmod Studio but ingame the first transition would always be selected.

I’m was using Fmod Studio 1.05.11 when I realized the problem, tried upgrading to 1.05.15 but nothing changed.

Thanks!

---

<div class="post-metadata">

### Author: ![patrick](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/patrick/32/261_2.png) [@patrick](https://qa.fmod.com/u/patrick)
#### Post date: [April 14, 2015, 4:10am UTC](https://qa.fmod.com/t/shuffle-doesnt-work-ingame/11878/2 "2015-04-14T04:10:39Z")

</div>

Are you only creating/playing the event once? If so, have you tried setting FMOD\_ADVANCEDSETTINGS.randomSeed in your game when you create the sound system? Setting it to the system time should ensure you get correctly randomized playback.

---

<div class="post-metadata">

### Author: ![G-man](https://avatars.discourse-cdn.com/v4/letter/g/76d3ee/32.png) [@G-man](https://qa.fmod.com/u/G-man)
#### Post date: [April 15, 2015, 3:53pm UTC](https://qa.fmod.com/t/shuffle-doesnt-work-ingame/11878/3 "2015-04-15T15:53:13Z")

</div>

The FMOD\_ADVANCEDSETTINGS.randomSeed was actually not set, but unfortunately, fixing that didn’t change anything…  
Here’s the code:

```
if (!FMODCHECK(FMOD::Studio::System::create(&m_studioSystem))) return; FMODCHECK(m_studioSystem->getLowLevelSystem(&m_system));

 FMODCHECK(m_system->set3DSettings(AudioDopplerScale, AudioDistanceFactor, AudioRolloffScale));

 m_advancedSettings.cbSize = sizeof(FMOD_ADVANCEDSETTINGS); FMODCHECK(m_system->getAdvancedSettings(&m_advancedSettings)); m_advancedSettings.cbSize = sizeof(FMOD_ADVANCEDSETTINGS); m_advancedSettings.randomSeed = static_cast<unsigned int>(time(o)); FMODCHECK(m_system->setAdvancedSettings(&m_advancedSettings));

 // Initialize FMOD. if (!FMODCHECK(m_studioSystem->initialize(AudioChannels, FMOD_STUDIO_INIT_NORMAL, FMOD_INIT_3D_RIGHTHANDED, 0x0))) return;
```

---

<div class="post-metadata">

### Author: ![patrick](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/patrick/32/261_2.png) [@patrick](https://qa.fmod.com/u/patrick)
#### Post date: [April 23, 2015, 3:48am UTC](https://qa.fmod.com/t/shuffle-doesnt-work-ingame/11878/4 "2015-04-23T03:48:41Z")

</div>

I’ve tested with your code and it does appear to work in Studio 1.06.01. If you’re still encountering the issue, please send an email to [support@fmod.org](mailto:support@fmod.org) (and mention the version you’re using) so that we can do further investigation.

---

<div class="post-metadata">

### Author: ![G-man](https://avatars.discourse-cdn.com/v4/letter/g/76d3ee/32.png) [@G-man](https://qa.fmod.com/u/G-man)
#### Post date: [April 23, 2015, 8:03am UTC](https://qa.fmod.com/t/shuffle-doesnt-work-ingame/11878/5 "2015-04-23T08:03:56Z")

</div>

> [@](#):
>
> I’ve tested with your code and it does appear to work in Studio 1.06.01. If you’re still encountering the issue, please send an email to [support@fmod.org](mailto:support@fmod.org) (and mention the version you’re using) so that we can do further investigation.

I checked it again this morning and strangely enough it seems to be working now… I have no idea why it didn’t work last time I checked since we haven’t changed anything around there, but I suspect some kind of human error.

Why isn’t FMOD\_ADVANCEDSETTINGS.randomSeed set by default by the way?

---

<div class="post-metadata">

### Author: ![patrick](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/patrick/32/261_2.png) [@patrick](https://qa.fmod.com/u/patrick)
#### Post date: [April 27, 2015, 5:22am UTC](https://qa.fmod.com/t/shuffle-doesnt-work-ingame/11878/6 "2015-04-27T05:22:32Z")

</div>

We don’t set randomSeed as this is a common convention. For example, you need to call srand() for the standard C library if you want rand() to be non-deterministic.
