asiftasleem / nbuilder

Automatically exported from code.google.com/p/nbuilder
0 stars 0 forks source link

New override for GetRandom.Phrase() ? #49

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I'm wondering if this could be considered as an enhancement for this project :-

GetRandom.Phrase(int minNumCharacters, maxNumOfCharacters)

eg.
GetRandom.Phrase(10, 50);

Currently, I'm doing a lot of this .. so i ended up making an extension method 
instead.

GetRandom.Phrase(GetRandom.Int(10, 70))) .. to try and spice up the phrase 
lengths a bit more..

-me- :)

Original issue reported on code.google.com by b8384...@klzlk.com on 3 Sep 2010 at 1:10

GoogleCodeExporter commented 8 years ago
Hi Justin,

I have begun working on this feature. Are you able to supply me with some 
clarifications concerning what you are after because the example you provide of 
GetRandom.Phrase(GetRandom.Int(10,70)) for your workaround does not achieve 
what you have requested.

GetRandom.Int(10,70) will return an integer value between 10 and 70.. eg 20.

GetRandom.Phrase(20) will then return a phrase with a length between 0 and 20.

However, the enhancement you have requested is GetRandom.Phrase(int 
minNumCharacters, maxNumOfCharacters). Can you please confirm that this is the 
enhancement that you are wanting?

Thanks,
Joshua Roth

Original comment by joshuajr...@gmail.com on 20 Sep 2010 at 9:23

GoogleCodeExporter commented 8 years ago
Hello Joshua and thanks so much for looking into this suggestion.

>>However, the enhancement you have requested is GetRandom.Phrase(int 
minNumCharacters, maxNumOfCharacters). Can you please confirm that this is the 
enhancement that you are wanting?

That is correct.

Some example scenarios:-

1) var phrase1 = GetRandom.Phrase(1, 10);
   // possible results.
   a) "hs sdak we" // 10 chars - max result.
   b) "s"  // 1 char, min result.
   c) "ajqufigff" // 9 chars - random result.
   d) "     "  // 5 chars - random result.

2) var phrase2 = GetRandom.Phrase(10, 70);
  // possible results.
   a) "jdmn fwolg" // 10 chars. min result.
   b_ "fjei ifjhs fjfjwjejefd dkfj pqm wj" // u get the idea..

NOW, sometimes we don't know what the min and max will be, so we randomize THAT 
also :)

3) int min = GetRandom.Int(10,70); // returns 32.
   int max = GetRandom.Int(min + 1, 100); // from 32 to some random number .. say 86.
   var phrase = GetRandom.Phrase(min, max); // random number chars between 32 and 86.

This way, i feel that we're getting even more randomness .. but i don't think 
people will really bother too much with suggestion #3 if they are using a large 
min/max range.

Does this help / help answer the question?

-Justin-

Original comment by pure.kro...@gmail.com on 21 Sep 2010 at 12:05