{"action":"created","issue":{"url":"https://api.github.com/repos/NARKOZ/hacker-scripts/issues/117","labels_url":"https://api.github.com/repos/NARKOZ/hacker-scripts/issues/117/labels{/name}","comments_url":"https://api.github.com/repos/NARKOZ/hacker-scripts/issues/117/comments","events_url":"https://api.github.com/repos/NARKOZ/hacker-scripts/issues/117/events","html_url":"https://github.com/NARKOZ/hacker-scripts/issues/117","id":122438466,"number":117,"title":"potential out of range error","user":{"login":"at0g","id":1406770,"avatar_url":"https://avatars.githubusercontent.com/u/1406770?v=3","gravatar_id":"","url":"https://api.github.com/users/at0g","html_url":"https://github.com/at0g","followers_url":"https://api.github.com/users/at0g/followers","following_url":"https://api.github.com/users/at0g/following{/other_user}","gists_url":"https://api.github.com/users/at0g/gists{/gist_id}","starred_url":"https://api.github.com/users/at0g/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/at0g/subscriptions","organizations_url":"https://api.github.com/users/at0g/orgs","repos_url":"https://api.github.com/users/at0g/repos","events_url":"https://api.github.com/users/at0g/events{/privacy}","received_events_url":"https://api.github.com/users/at0g/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-12-16T06:19:53Z","updated_at":"2015-12-28T17:57:04Z","closed_at":null,"body":"This line: https://github.com/NARKOZ/hacker-scripts/blob/master/nodejs/hangover.js#L33\r\n\r\n`var excuse = excuses[Math.floor(Math.random() * excuses.length)];`\r\n\r\nshould be:\r\n\r\n`var excuse = excuses[Math.floor(Math.random() * excuses.length - 1)];`\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/NARKOZ/hacker-scripts/issues/comments/167614230","html_url":"https://github.com/NARKOZ/hacker-scripts/issues/117#issuecomment-167614230","issue_url":"https://api.github.com/repos/NARKOZ/hacker-scripts/issues/117","id":167614230,"user":{"login":"xsami","id":8741762,"avatar_url":"https://avatars.githubusercontent.com/u/8741762?v=3","gravatar_id":"","url":"https://api.github.com/users/xsami","html_url":"https://github.com/xsami","followers_url":"https://api.github.com/users/xsami/followers","following_url":"https://api.github.com/users/xsami/following{/other_user}","gists_url":"https://api.github.com/users/xsami/gists{/gist_id}","starred_url":"https://api.github.com/users/xsami/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xsami/subscriptions","organizations_url":"https://api.github.com/users/xsami/orgs","repos_url":"https://api.github.com/users/xsami/repos","events_url":"https://api.github.com/users/xsami/events{/privacy}","received_events_url":"https://api.github.com/users/xsami/received_events","type":"User","site_admin":false},"created_at":"2015-12-28T17:57:04Z","updated_at":"2015-12-28T17:57:04Z","body":"@at0g you are wrong because `Math.random() * excuses.length - 1` could give you a negative integer, the proper way is `var excuse = excuses[Math.floor(Math.random() * excuses.length)%excuses.length];`"}}