Your are missing a lot of ';' in your javascript code :
EDIT
here is a working code : (DEMO JSFiddle)
function slider(x) {
var rand = Math.round(Math.random() * (5000 - 1000)) + 1000;
// go to left
setTimeout(function () {
var size = x.parent().width();
var futureLoc = x.offset().left + x.outerWidth(true) - size;
var parentLoc = x.parent().offset().left;
if (futureLoc <= parentLoc) {
console.log("Loop");
x.animate({
"left": "0px"
},function(){slider(x);});
} else {
x.animate({
"left": "-=" + size + "px"
}, 2000,function(){slider(x);});
}
}, rand);
}
$("ul.slider-ul").each(function () {
slider($(this));
});
I had to change a lot of things and the animation is empty before it reset so you will have to play with it do have a perfect animation.