VictorSlate,
<!DOCTYPE html>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
<style type="text/css">
#elements div {
display: none;
}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script>
$(function() {
var divs = $("#elements div").get(), len = divs.length;
var arr = localStorage.getItem("arr");
if (!arr) {
arr = [];
for (; len;) {
arr.push(Math.random() * len-- | 0);
}
localStorage.setItem("arr", JSON.stringify(arr));
} else {
arr = JSON.parse(arr);
}
arr.forEach(function(e) {
$(divs.splice(e, 1)).prependTo("#elements").show();
});
});
</script>
</head>
<body>
<div id="elements">
<div id="container-1">
Текст 1
</div>
<div id="container-2">
Текст 2
</div>
<div id="container-3">
Текст 3
</div>
<div id="container-4">
Текст 4
</div>
<div id="container-5">
Текст 5
</div>
</div>
</body>
</html>