greg icon indicating copy to clipboard operation
greg copied to clipboard

Count between 2 and 33 instead of 34

Open josher19 opened this issue 11 years ago • 1 comments

It is currently possible to generate random sentences which are not the same but have the same id when parsed. Example:

exports = require('greg');

var phrase1 = '34 cute rabbits sang jovially',
    phrase2 = '2 dapper rabbits sang jovially';

exports.parse(phrase1) === exports.parse(phrase2); // true, both 34.

Updating the count to have a range from 2 to 33 instead of 2 to 34 fixes this.

josher19 avatar Jan 05 '13 05:01 josher19

Thanks @josher19, I'm not sure of the benefit of the fromId and confirm functions -- would you care to elaborate? I actually got a longer list of words from "the" Greg, along with (part of) his implementation. I haven't added the words out of laziness, but I probably should.

linus avatar Jan 07 '13 18:01 linus