Html does not have a rand function, on this example i'm gonna use javascript as well. The javascript rand function is not very helpful on this 'cause it gives any number between 0 and 1. What i suggest to do is based on the second the page is loaded, do some math and then apply the background 1, 2 or 3. Hope this helps you.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script type="text/javascript">
function randBg(){
var s= new Date();
s= s.getSeconds();
n1 = s/2- Math.floor(s/2);
n2 = s/3- Math.floor(s/3);
if (n1==0){document.getElementById("bd").style.background = "url(b2.jpg)";}
else if (n2==0){document.getElementById("bd").style.background = "url(b3.jpg)";}
else {document.getElementById("bd").style.background = "url(b1.jpg)";}
}
</script>
</head>
<body id="bd" onLoad="randBg();">