Photo XML gallery + first image random

Hi there,

I already managed to customize the photo xml gallery code to a random image gallery. But the problem now is that the first picture is not random choosen.

So instead to initialize p = 0 , I tried this :

p = Math.floor(Math.random() * total);

But unfortunaly then I get NaN :frowning:

I just want to get this : onload -> first image is a random image ( for example 5 / 10 ) then when I press next it continues counting to 6/10, /, … when I press previous it countinues counting backward to 4/10, 3/10, …

Anyone can help me out ?