Skip to content

Commit 5887bcb

Browse files
author
Kim Maida
authored
Update quoter.js to ensure 0 index can be returned
1 parent 8a3e52e commit 5887bcb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

quoter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ var quotes = require('./quotes.json');
22

33
exports.getRandomOne = function() {
44
var totalAmount = quotes.length;
5-
var rand = Math.ceil(Math.random() * (totalAmount - 1));
5+
var rand = Math.floor(Math.random() * totalAmount);
66
return quotes[rand];
77
}

0 commit comments

Comments
 (0)