Skip to content

Commit

Permalink
Randomize words DB
Browse files Browse the repository at this point in the history
  • Loading branch information
vonBarbarosa committed Feb 21, 2016
1 parent 24c6c3e commit 52a858a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion js/functions.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var currentWord = {
index: 2,
index: -1,
ortography: "",
phonology: [],
alternative: [],
Expand Down
13 changes: 13 additions & 0 deletions js/wordsDB.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
function shuffleArray(array) {
for (var i = array.length - 1; i > 0; i--) {
var j = Math.floor(Math.random() * (i + 1));
var temp = array[i];
array[i] = array[j];
array[j] = temp;
}
return array;
}


var wordsDB = [
{
//agora a.ˈgɔ.rə
Expand Down Expand Up @@ -36,3 +47,5 @@ var wordsDB = [
phonology : ["ˈdeʊ̯s","ˈdeʊ̯ʃ"]
}
];

shuffleArray(wordsDB);

0 comments on commit 52a858a

Please sign in to comment.