Skip to content

Commit

Permalink
Fix random language pick.
Browse files Browse the repository at this point in the history
  • Loading branch information
hermanzdosilovic committed Jan 1, 2020
1 parent 4035c49 commit 463a5ce
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion js/ide.js
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,11 @@ function insertTemplate() {
}

function loadRandomLanguage() {
$selectLanguage.dropdown("set selected", Math.floor(Math.random() * $selectLanguage[0].length));
var values = [];
for (var i = 0; i < $selectLanguage[0].options.length; ++i) {
values.push($selectLanguage[0].options[i].value);
}
$selectLanguage.dropdown("set selected", values[Math.floor(Math.random() * $selectLanguage[0].length)]);
apiUrl = resolveApiUrl($selectLanguage.val());
showApiUrl();
insertTemplate();
Expand Down

0 comments on commit 463a5ce

Please sign in to comment.