{"action":"created","issue":{"url":"https://api.github.com/repos/typelift/SwiftCheck/issues/88","labels_url":"https://api.github.com/repos/typelift/SwiftCheck/issues/88/labels{/name}","comments_url":"https://api.github.com/repos/typelift/SwiftCheck/issues/88/comments","events_url":"https://api.github.com/repos/typelift/SwiftCheck/issues/88/events","html_url":"https://github.com/typelift/SwiftCheck/issues/88","id":104608764,"number":88,"title":"Gen.chooseNum() aka proliferateSized(min, max)","user":{"login":"zbeckman","id":5351337,"avatar_url":"https://avatars.githubusercontent.com/u/5351337?v=3","gravatar_id":"","url":"https://api.github.com/users/zbeckman","html_url":"https://github.com/zbeckman","followers_url":"https://api.github.com/users/zbeckman/followers","following_url":"https://api.github.com/users/zbeckman/following{/other_user}","gists_url":"https://api.github.com/users/zbeckman/gists{/gist_id}","starred_url":"https://api.github.com/users/zbeckman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zbeckman/subscriptions","organizations_url":"https://api.github.com/users/zbeckman/orgs","repos_url":"https://api.github.com/users/zbeckman/repos","events_url":"https://api.github.com/users/zbeckman/events{/privacy}","received_events_url":"https://api.github.com/users/zbeckman/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-09-03T02:30:09Z","updated_at":"2015-09-03T03:47:57Z","closed_at":null,"body":"It would be great to have an ability to build generators that generate a specific (but random) range. For example, taking from my Scala code:\r\n```\r\ndef unicodeGenerator(generator: Gen[Char] = Gen.alphaChar, minimum: Int = 5, maximum: Int = 20): Gen[String] = Gen.chooseNum(minimum, maximum).flatMap { n =>\r\n\tGen.buildableOfN[String, Char](n, generator)\r\n}\r\n```\r\nThe above generates a random series of Unicode between 5 and 20 characters. Another expression that's pretty useful:\r\n```\r\nval shortCodeGenerator: Gen[String] = Gen.chooseNum(3, 10).flatMap { n =>\r\n\tGen.sequence[String, Char](List.fill(n)(Gen.alphaNumChar))\r\n}\r\n```\r\nIn this latter example, I'm creating an alphanumeric code that is 3 to 10 characters in length.\r\n\r\nIt would be very handy to be able to specify a range as in proliferateSized(min, max)."},"comment":{"url":"https://api.github.com/repos/typelift/SwiftCheck/issues/comments/137322819","html_url":"https://github.com/typelift/SwiftCheck/issues/88#issuecomment-137322819","issue_url":"https://api.github.com/repos/typelift/SwiftCheck/issues/88","id":137322819,"user":{"login":"CodaFi","id":1896383,"avatar_url":"https://avatars.githubusercontent.com/u/1896383?v=3","gravatar_id":"","url":"https://api.github.com/users/CodaFi","html_url":"https://github.com/CodaFi","followers_url":"https://api.github.com/users/CodaFi/followers","following_url":"https://api.github.com/users/CodaFi/following{/other_user}","gists_url":"https://api.github.com/users/CodaFi/gists{/gist_id}","starred_url":"https://api.github.com/users/CodaFi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CodaFi/subscriptions","organizations_url":"https://api.github.com/users/CodaFi/orgs","repos_url":"https://api.github.com/users/CodaFi/repos","events_url":"https://api.github.com/users/CodaFi/events{/privacy}","received_events_url":"https://api.github.com/users/CodaFi/received_events","type":"User","site_admin":false},"created_at":"2015-09-03T03:47:57Z","updated_at":"2015-09-03T03:47:57Z","body":"If you know the range then fromElementsIn can be used as a size block."}}