Skip to content

Commit

Permalink
inclusive math.random check; use crypto instead if available
Browse files Browse the repository at this point in the history
  • Loading branch information
w3cj committed Apr 5, 2016
1 parent ddc5a1b commit 3d50be9
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,14 @@ <h3 class="masthead-brand">Cover</h3>

var random = Math.random();
var direction = 'left';
if (random > 0.5) {

if(window.crypto) {
random = window.crypto.getRandomValues(new Uint8Array(1))[0];
if(random >= 128) {
direction = 'right';
}
} else if (random >= 0.5) {
direction = 'right';
}

setTimeout(function() {
Expand All @@ -286,4 +292,4 @@ <h3 class="masthead-brand">Cover</h3>
}
});

</script>
</script>

0 comments on commit 3d50be9

Please sign in to comment.