Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(916)

Issue 5676079: code review 5676079: math/rand: Intn etc. should panic if their argument is <= 0. (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
13 years, 3 months ago by r
Modified:
13 years, 3 months ago
Reviewers:
CC:
golang-dev, dsymonds, rsc
Visibility:
Public.

Description

math/rand: Intn etc. should panic if their argument is <= 0. I am making a unilateral decision here. I could also settle for returning 0, as long it's documented, but I argue that it's equivalent to an index out of bounds. Fixes issue 2892.

Patch Set 1 #

Patch Set 2 : diff -r f11edbb3cd95 https://code.google.com/p/go/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+11 lines, -2 lines) Patch
M src/pkg/math/rand/rand.go View 1 4 chunks +11 lines, -2 lines 0 comments Download

Messages

Total messages: 4
r
Hello golang-dev@googlegroups.com, I'd like you to review this change to https://code.google.com/p/go/
13 years, 3 months ago (2012-02-17 12:22:48 UTC) #1
dsymonds
LGTM but s/negative/non-positive/ or similar. Zero is neither positive nor negative.
13 years, 3 months ago (2012-02-17 12:44:17 UTC) #2
rsc
LGTM invalid is fine too
13 years, 3 months ago (2012-02-17 14:34:44 UTC) #3
r
13 years, 3 months ago (2012-02-17 21:53:13 UTC) #4
*** Submitted as 45c313581bc4 ***

math/rand: Intn etc. should panic if their argument is <= 0.

I am making a unilateral decision here. I could also settle for returning 0,
as long it's documented, but I argue that it's equivalent to an index
out of bounds.

Fixes issue 2892.

R=golang-dev, dsymonds, rsc
CC=golang-dev
http://codereview.appspot.com/5676079
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b