Skip to content

Commit

Permalink
reduce fn call stack
Browse files Browse the repository at this point in the history
  • Loading branch information
kurttheviking committed Mar 15, 2015
1 parent 97abc07 commit 0e5f146
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
6 changes: 1 addition & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ var Algorithm = function (options) {
values.push(0);
}

function indexOfMax() {
return values.indexOf(Math.max.apply(null, values));
}

var api = {};

api.n = 0;
Expand Down Expand Up @@ -83,7 +79,7 @@ var Algorithm = function (options) {
if (epsilon > _.random(0, 1, true) || api.n === 0) {
arm = _.random(0, arms-1);
} else {
arm = indexOfMax();
arm = values.indexOf(Math.max.apply(null, values));
}

resolve(arm);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "banditdb-egreedy",
"description": "A Promises/A+, epsilon-greedy multi-armed bandit",
"version": "0.1.0",
"version": "0.1.1",
"author": "kurttheviking",
"contributors": [
"kurttheviking"
Expand Down

0 comments on commit 0e5f146

Please sign in to comment.