mirror of
https://github.com/dmuth/diceware.git
synced 2024-11-21 08:26:29 -05:00
Removed old dice rolling logic.
This commit is contained in:
parent
61fb6fa227
commit
6c99fd1168
1 changed files with 0 additions and 44 deletions
44
main.js
44
main.js
|
@ -184,50 +184,6 @@ Diceware.rollDice = function(num_dice) {
|
||||||
} // End of rollDice()
|
} // End of rollDice()
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Roll a die.
|
|
||||||
*
|
|
||||||
* @return integer A random number between 1 and 6, inclusive.
|
|
||||||
*/
|
|
||||||
Diceware.die_roll = function() {
|
|
||||||
|
|
||||||
var retval;
|
|
||||||
|
|
||||||
if (Diceware.i_can_has_good_crypto()) {
|
|
||||||
var a = new Uint32Array(1);
|
|
||||||
window.crypto.getRandomValues(a);
|
|
||||||
retval = (a[0] % 6) + 1;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
//
|
|
||||||
// Fall back to something way less secure. The user has already
|
|
||||||
// been warned.
|
|
||||||
//
|
|
||||||
retval = Math.floor(Math.random() * 6) + 1;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return(retval);
|
|
||||||
|
|
||||||
} // End of die_roll()
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Roll a die 5 times.
|
|
||||||
*
|
|
||||||
* @return array an Array of 5 dice rolls
|
|
||||||
*/
|
|
||||||
Diceware.roll_dice = function() {
|
|
||||||
var retval = new Array();
|
|
||||||
retval.push(Diceware.die_roll());
|
|
||||||
retval.push(Diceware.die_roll());
|
|
||||||
retval.push(Diceware.die_roll());
|
|
||||||
retval.push(Diceware.die_roll());
|
|
||||||
retval.push(Diceware.die_roll());
|
|
||||||
return(retval);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Look up a word from our wordlist.
|
* Look up a word from our wordlist.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue