Created
June 2, 2011 23:26
-
-
Save fabriziogiordano/1005567 to your computer and use it in GitHub Desktop.
Javascript Math Floor vs. Bitwise operator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset=utf-8 /> | |
<title>[Javascript] Math floor and bitwise operator</title> | |
<!--[if IE]> | |
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> | |
<![endif]--> | |
<style> | |
article, aside, figure, footer, header, hgroup, | |
menu, nav, section { display: block; } | |
</style> | |
</head> | |
<body> | |
<p id="result"> </p> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var a = []; | |
var time = new Date().getTime(); | |
var result = document.getElementById('result'); | |
for( i = 0; i < 1000; i++ ) { | |
//result.innerHTML += '<br/>' + (Math.random() * 100000 | 0); | |
result.innerHTML += '<br/>' + Math.floor( Math.random() * 100000 ); | |
} | |
var elapsed = new Date().getTime() - time; | |
alert( "elapsed time: " + elapsed ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment