Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
parity
Mirrored projects
parity-signer
Commits
54189492
Commit
54189492
authored
Feb 20, 2017
by
Marek Kotewicz
Browse files
workaround for missing Uint16Array on android
parent
1cf55d89
Changes
1
Show whitespace changes
Inline
Side-by-side
src/util/random.js
View file @
54189492
...
...
@@ -2,7 +2,7 @@ import dictionary from '../../res/words.json'
// TODO: make it secure!
export
function
words
()
{
let
buf
=
(
new
Uint16Array
(
11
)).
map
(
_
=>
Math
.
random
()
*
dictionary
.
length
)
return
Array
.
from
(
buf
)
.
map
(
n
=>
dictionary
[
n
]).
join
(
'
'
)
let
buf
=
Array
.
apply
(
null
,
{
length
:
11
}).
map
(
Function
.
call
,
()
=>
Math
.
random
()
*
dictionary
.
length
)
return
buf
.
map
(
n
=>
dictionary
[
Math
.
floor
(
n
)
]).
join
(
'
'
)
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment