directory

Sorting a structure randomly

biro's picture

Hi Guys! this is my first post. So forgive me if the question could seem stupid

I have a directory scanner that retrieve me the list of movies in a specific folder. I'd like to "randomize the order" of that list, so every time i trig the structure, i can scramble the order.

I've tried with javascript with something like this PHP Code: function (__structure out) main (__structure input){ if(input !=null){ var result=new Object(); result.out=input.sort(function(){return (Math.round(Math.random())-0.5)); return result; } }
but it doesen't work....and i don't know neither how to debug it...

Any solution???

Thanks