This doesn't require jQuery. The JavaScript Math.random
function returns a random number between 0 and 1, so if you want a number between 1 and 6, you can do:
var number = 1 + Math.floor(Math.random() * 6);
Update: (as per comment) If you want to display a random number that changes every so often, you can use setInterval
to create a timer:
setInterval(function() {
var number = 1 + Math.floor(Math.random() * 6);
$('#my_div').text(number);
},
1000); // every 1 second
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…