Skip to content

Conversation

@joshua-peterson-volusion

Fixed ARandom.Int to actually return a normal int.
Fixed ARandom.String to include the entire alphabet.

Joshua Peterson added 2 commits August 2, 2013 14:42
@ChrisEdwards
Copy link
Owner

What would you think about ARandom.Int returning only from 0 to int.MaxValue? I think most existing code that would break would be due to negative numbers, not overly large ones. Just like ARandom.String doesn't return all possible chars, ARandom.Int doesn't return all possible ints. It's the most common ones (positive). I think it makes sense to only return negative numbers when the programmer explicitly requests them. Thoughts?

@jamessmckay
Copy link

What if ARandom.Int takes some args, a min and max number? that way if you
want negative numbers you can have them

On Mon, Aug 5, 2013 at 11:44 PM, Chris Edwards notifications@github.comwrote:

What would you think about ARandom.Int returning only from 0 to
int.MaxValue? I think most existing code that would break would be due to
negative numbers, not overly large ones. Just like ARandom.String doesn't
return all possible chars, ARandom.Int doesn't return all possible ints.
It's the most common ones (positive). I think it makes sense to only return
negative numbers when the programmer explicitly requests them. Thoughts?


Reply to this email directly or view it on GitHubhttps://github.com//pull/8#issuecomment-22158091
.

@ChrisEdwards
Copy link
Owner

There's a method called ARandom.IntBetween(x,y) that does that already.

On Tue, Aug 6, 2013 at 7:35 AM, jamessmckay notifications@github.comwrote:

What if ARandom.Int takes some args, a min and max number? that way if you
want negative numbers you can have them

On Mon, Aug 5, 2013 at 11:44 PM, Chris Edwards notifications@github.comwrote:

What would you think about ARandom.Int returning only from 0 to
int.MaxValue? I think most existing code that would break would be due
to
negative numbers, not overly large ones. Just like ARandom.String
doesn't
return all possible chars, ARandom.Int doesn't return all possible ints.
It's the most common ones (positive). I think it makes sense to only
return
negative numbers when the programmer explicitly requests them. Thoughts?


Reply to this email directly or view it on GitHub<
https://github.com/ChrisEdwards/Fluency/pull/8#issuecomment-22158091>
.


Reply to this email directly or view it on GitHubhttps://github.com//pull/8#issuecomment-22175506
.

Chris Edwards

"Whatever you do, work at it with all your heart, as working for the Lord,
not for men"

  • Col 3:23

@joshua-peterson-volusion
Copy link
Author

I would disagree with that. If I ask for ARandom.Int, I expect a random int. I would completely support 2 additional methods, ARandom.PositiveInt and ARandom.NegativeInt.

I would be less worried about the people that are (wrongly) expecting only positive number and more worried about those that think they are testing against the entire spectrum of ints and are only using a very small subset of ints.

From: Chris Edwards [mailto:notifications@github.com]
Sent: Monday, August 5, 2013 11:45 PM
To: ChrisEdwards/Fluency
Cc: Joshua Peterson
Subject: Re: [Fluency] Fixed 2 methods in ARandom to return more appropriate values (#8)

What would you think about ARandom.Int returning only from 0 to int.MaxValue? I think most existing code that would break would be due to negative numbers, not overly large ones. Just like ARandom.String doesn't return all possible chars, ARandom.Int doesn't return all possible ints. It's the most common ones (positive). I think it makes sense to only return negative numbers when the programmer explicitly requests them. Thoughts?


Reply to this email directly or view it on GitHubhttps://github.com//pull/8#issuecomment-22158091.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants