forked from bizzbyster/bizzbyster.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
show_rand_date.html
35 lines (34 loc) · 1.01 KB
/
show_rand_date.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<!doctype html>
<html>
<head>
<title>Request small file every 2 seconds to test TCP latency</title>
</head>
<body>
<h1>Calls to Math.random()</h1>
<script type="text/javascript">
document.write("<p>" + Math.random() + "</p>");
document.write("<p>" + Math.random() + "</p>");
document.write("<p>" + Math.random() + "</p>");
document.write("<p>" + Math.random() + "</p>");
</script>
<h1>Calls to Date()</h1>
<script type="text/javascript">
function sleep(milliseconds){
var start = new Date().getTime();
var keep_looping = true;
while (keep_looping) {
if ((new Date().getTime() - start)> milliseconds) {
keep_looping = false;
}
}
}
document.write("<p>" + Date.now() + "</p>");
sleep(2);
document.write("<p>" + Date.now() + "</p>");
sleep(2);
document.write("<p>" + Date.now() + "</p>");
sleep(2);
document.write("<p>" + Date.now() + "</p>");
</script>
</body>
</html>