{"action":"created","comment":{"url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/pulls/comments/61102014","id":61102014,"diff_hunk":"@@ -1,16 +1,20 @@\n+\"use strict\";\n var random = require('../core/random');\n-var MIN_INTEGER = -100000000, MAX_INTEGER = 100000000;\n+var MIN_INTEGER = -100000000, MAX_INTEGER = 100000000, FLOAT_DIFFERENCE = 0.1;\n function numberType(value) {\n     var min = typeof value.minimum === 'undefined' ? MIN_INTEGER : value.minimum, max = typeof value.maximum === 'undefined' ? MAX_INTEGER : value.maximum, multipleOf = value.multipleOf;\n     if (multipleOf) {\n         max = Math.floor(max / multipleOf) * multipleOf;\n         min = Math.ceil(min / multipleOf) * multipleOf;\n     }\n+    // if both numbers are integers the difference should be an integer too,\n+    // otherwise having values like { min: 1, max: 1.5 } will produce invalid values (NaN)\n+    var fixedUnit = ((min % 1) === 0 && (max % 1) === 0) ? 1 : FLOAT_DIFFERENCE;\n     if (value.exclusiveMinimum && value.minimum && min === value.minimum) {\n-        min += multipleOf || 1;\n+        min += multipleOf || fixedUnit;\n     }\n     if (value.exclusiveMaximum && value.maximum && max === value.maximum) {\n-        max -= multipleOf || 1;\n+        max -= multipleOf || fixedUnit;\n     }","path":"lib/types/number.js","position":21,"original_position":21,"commit_id":"167bfb6772cf97de0ebfb6c889308ab410537d35","original_commit_id":"167bfb6772cf97de0ebfb6c889308ab410537d35","user":{"login":"pateketrueke","id":206371,"avatar_url":"https://avatars.githubusercontent.com/u/206371?v=3","gravatar_id":"","url":"https://api.github.com/users/pateketrueke","html_url":"https://github.com/pateketrueke","followers_url":"https://api.github.com/users/pateketrueke/followers","following_url":"https://api.github.com/users/pateketrueke/following{/other_user}","gists_url":"https://api.github.com/users/pateketrueke/gists{/gist_id}","starred_url":"https://api.github.com/users/pateketrueke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pateketrueke/subscriptions","organizations_url":"https://api.github.com/users/pateketrueke/orgs","repos_url":"https://api.github.com/users/pateketrueke/repos","events_url":"https://api.github.com/users/pateketrueke/events{/privacy}","received_events_url":"https://api.github.com/users/pateketrueke/received_events","type":"User","site_admin":false},"body":"That was my best guess, I'll improve the solution for numbers whilst `NaN` is OK I think we could throw an exception for that, let me see what can I do, thanks for your advice! :beer: ","created_at":"2016-04-26T15:01:04Z","updated_at":"2016-04-26T15:01:04Z","html_url":"https://github.com/json-schema-faker/json-schema-faker/pull/144#discussion_r61102014","pull_request_url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/pulls/144","_links":{"self":{"href":"https://api.github.com/repos/json-schema-faker/json-schema-faker/pulls/comments/61102014"},"html":{"href":"https://github.com/json-schema-faker/json-schema-faker/pull/144#discussion_r61102014"},"pull_request":{"href":"https://api.github.com/repos/json-schema-faker/json-schema-faker/pulls/144"}}},"pull_request":{"url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/pulls/144","id":67492072,"html_url":"https://github.com/json-schema-faker/json-schema-faker/pull/144","diff_url":"https://github.com/json-schema-faker/json-schema-faker/pull/144.diff","patch_url":"https://github.com/json-schema-faker/json-schema-faker/pull/144.patch","issue_url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/issues/144","number":144,"state":"open","locked":false,"title":"Fixed number/integer generators (via random)","user":{"login":"pateketrueke","id":206371,"avatar_url":"https://avatars.githubusercontent.com/u/206371?v=3","gravatar_id":"","url":"https://api.github.com/users/pateketrueke","html_url":"https://github.com/pateketrueke","followers_url":"https://api.github.com/users/pateketrueke/followers","following_url":"https://api.github.com/users/pateketrueke/following{/other_user}","gists_url":"https://api.github.com/users/pateketrueke/gists{/gist_id}","starred_url":"https://api.github.com/users/pateketrueke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pateketrueke/subscriptions","organizations_url":"https://api.github.com/users/pateketrueke/orgs","repos_url":"https://api.github.com/users/pateketrueke/repos","events_url":"https://api.github.com/users/pateketrueke/events{/privacy}","received_events_url":"https://api.github.com/users/pateketrueke/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-04-22T10:40:23Z","updated_at":"2016-04-26T15:01:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"69482de029f74ebb426146d3162c8033f7b6f168","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/pulls/144/commits","review_comments_url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/pulls/144/comments","review_comment_url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/pulls/comments{/number}","comments_url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/issues/144/comments","statuses_url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/statuses/167bfb6772cf97de0ebfb6c889308ab410537d35","head":{"label":"json-schema-faker:issue-142","ref":"issue-142","sha":"167bfb6772cf97de0ebfb6c889308ab410537d35","user":{"login":"json-schema-faker","id":13982985,"avatar_url":"https://avatars.githubusercontent.com/u/13982985?v=3","gravatar_id":"","url":"https://api.github.com/users/json-schema-faker","html_url":"https://github.com/json-schema-faker","followers_url":"https://api.github.com/users/json-schema-faker/followers","following_url":"https://api.github.com/users/json-schema-faker/following{/other_user}","gists_url":"https://api.github.com/users/json-schema-faker/gists{/gist_id}","starred_url":"https://api.github.com/users/json-schema-faker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/json-schema-faker/subscriptions","organizations_url":"https://api.github.com/users/json-schema-faker/orgs","repos_url":"https://api.github.com/users/json-schema-faker/repos","events_url":"https://api.github.com/users/json-schema-faker/events{/privacy}","received_events_url":"https://api.github.com/users/json-schema-faker/received_events","type":"Organization","site_admin":false},"repo":{"id":24914297,"name":"json-schema-faker","full_name":"json-schema-faker/json-schema-faker","owner":{"login":"json-schema-faker","id":13982985,"avatar_url":"https://avatars.githubusercontent.com/u/13982985?v=3","gravatar_id":"","url":"https://api.github.com/users/json-schema-faker","html_url":"https://github.com/json-schema-faker","followers_url":"https://api.github.com/users/json-schema-faker/followers","following_url":"https://api.github.com/users/json-schema-faker/following{/other_user}","gists_url":"https://api.github.com/users/json-schema-faker/gists{/gist_id}","starred_url":"https://api.github.com/users/json-schema-faker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/json-schema-faker/subscriptions","organizations_url":"https://api.github.com/users/json-schema-faker/orgs","repos_url":"https://api.github.com/users/json-schema-faker/repos","events_url":"https://api.github.com/users/json-schema-faker/events{/privacy}","received_events_url":"https://api.github.com/users/json-schema-faker/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/json-schema-faker/json-schema-faker","description":"JSON-Schema + Faker","fork":false,"url":"https://api.github.com/repos/json-schema-faker/json-schema-faker","forks_url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/forks","keys_url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/keys{/key_id}","collaborators_url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/teams","hooks_url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/hooks","issue_events_url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/issues/events{/number}","events_url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/events","assignees_url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/assignees{/user}","branches_url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/branches{/branch}","tags_url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/tags","blobs_url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/git/refs{/sha}","trees_url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/git/trees{/sha}","statuses_url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/statuses/{sha}","languages_url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/languages","stargazers_url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/stargazers","contributors_url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/contributors","subscribers_url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/subscribers","subscription_url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/subscription","commits_url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/commits{/sha}","git_commits_url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/git/commits{/sha}","comments_url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/comments{/number}","issue_comment_url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/issues/comments{/number}","contents_url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/contents/{+path}","compare_url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/compare/{base}...{head}","merges_url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/merges","archive_url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/downloads","issues_url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/issues{/number}","pulls_url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/pulls{/number}","milestones_url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/milestones{/number}","notifications_url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/labels{/name}","releases_url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/releases{/id}","deployments_url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/deployments","created_at":"2014-10-07T22:23:13Z","updated_at":"2016-04-25T13:53:24Z","pushed_at":"2016-04-26T07:22:39Z","git_url":"git://github.com/json-schema-faker/json-schema-faker.git","ssh_url":"git@github.com:json-schema-faker/json-schema-faker.git","clone_url":"https://github.com/json-schema-faker/json-schema-faker.git","svn_url":"https://github.com/json-schema-faker/json-schema-faker","homepage":"http://json-schema-faker.js.org/","size":7572,"stargazers_count":270,"watchers_count":270,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":31,"mirror_url":null,"open_issues_count":31,"forks":31,"open_issues":31,"watchers":270,"default_branch":"master"}},"base":{"label":"json-schema-faker:master","ref":"master","sha":"c0ca74108464d355ee37de555de33077db264152","user":{"login":"json-schema-faker","id":13982985,"avatar_url":"https://avatars.githubusercontent.com/u/13982985?v=3","gravatar_id":"","url":"https://api.github.com/users/json-schema-faker","html_url":"https://github.com/json-schema-faker","followers_url":"https://api.github.com/users/json-schema-faker/followers","following_url":"https://api.github.com/users/json-schema-faker/following{/other_user}","gists_url":"https://api.github.com/users/json-schema-faker/gists{/gist_id}","starred_url":"https://api.github.com/users/json-schema-faker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/json-schema-faker/subscriptions","organizations_url":"https://api.github.com/users/json-schema-faker/orgs","repos_url":"https://api.github.com/users/json-schema-faker/repos","events_url":"https://api.github.com/users/json-schema-faker/events{/privacy}","received_events_url":"https://api.github.com/users/json-schema-faker/received_events","type":"Organization","site_admin":false},"repo":{"id":24914297,"name":"json-schema-faker","full_name":"json-schema-faker/json-schema-faker","owner":{"login":"json-schema-faker","id":13982985,"avatar_url":"https://avatars.githubusercontent.com/u/13982985?v=3","gravatar_id":"","url":"https://api.github.com/users/json-schema-faker","html_url":"https://github.com/json-schema-faker","followers_url":"https://api.github.com/users/json-schema-faker/followers","following_url":"https://api.github.com/users/json-schema-faker/following{/other_user}","gists_url":"https://api.github.com/users/json-schema-faker/gists{/gist_id}","starred_url":"https://api.github.com/users/json-schema-faker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/json-schema-faker/subscriptions","organizations_url":"https://api.github.com/users/json-schema-faker/orgs","repos_url":"https://api.github.com/users/json-schema-faker/repos","events_url":"https://api.github.com/users/json-schema-faker/events{/privacy}","received_events_url":"https://api.github.com/users/json-schema-faker/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/json-schema-faker/json-schema-faker","description":"JSON-Schema + Faker","fork":false,"url":"https://api.github.com/repos/json-schema-faker/json-schema-faker","forks_url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/forks","keys_url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/keys{/key_id}","collaborators_url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/teams","hooks_url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/hooks","issue_events_url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/issues/events{/number}","events_url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/events","assignees_url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/assignees{/user}","branches_url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/branches{/branch}","tags_url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/tags","blobs_url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/git/refs{/sha}","trees_url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/git/trees{/sha}","statuses_url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/statuses/{sha}","languages_url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/languages","stargazers_url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/stargazers","contributors_url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/contributors","subscribers_url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/subscribers","subscription_url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/subscription","commits_url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/commits{/sha}","git_commits_url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/git/commits{/sha}","comments_url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/comments{/number}","issue_comment_url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/issues/comments{/number}","contents_url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/contents/{+path}","compare_url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/compare/{base}...{head}","merges_url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/merges","archive_url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/downloads","issues_url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/issues{/number}","pulls_url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/pulls{/number}","milestones_url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/milestones{/number}","notifications_url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/labels{/name}","releases_url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/releases{/id}","deployments_url":"https://api.github.com/repos/json-schema-faker/json-schema-faker/deployments","created_at":"2014-10-07T22:23:13Z","updated_at":"2016-04-25T13:53:24Z","pushed_at":"2016-04-26T07:22:39Z","git_url":"git://github.com/json-schema-faker/json-schema-faker.git","ssh_url":"git@github.com:json-schema-faker/json-schema-faker.git","clone_url":"https://github.com/json-schema-faker/json-schema-faker.git","svn_url":"https://github.com/json-schema-faker/json-schema-faker","homepage":"http://json-schema-faker.js.org/","size":7572,"stargazers_count":270,"watchers_count":270,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":31,"mirror_url":null,"open_issues_count":31,"forks":31,"open_issues":31,"watchers":270,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/json-schema-faker/json-schema-faker/pulls/144"},"html":{"href":"https://github.com/json-schema-faker/json-schema-faker/pull/144"},"issue":{"href":"https://api.github.com/repos/json-schema-faker/json-schema-faker/issues/144"},"comments":{"href":"https://api.github.com/repos/json-schema-faker/json-schema-faker/issues/144/comments"},"review_comments":{"href":"https://api.github.com/repos/json-schema-faker/json-schema-faker/pulls/144/comments"},"review_comment":{"href":"https://api.github.com/repos/json-schema-faker/json-schema-faker/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/json-schema-faker/json-schema-faker/pulls/144/commits"},"statuses":{"href":"https://api.github.com/repos/json-schema-faker/json-schema-faker/statuses/167bfb6772cf97de0ebfb6c889308ab410537d35"}}}}