Skip to content

[SR-8143] Should RNG.next(upperBound: 0) be a preconditionFailure? #50675

@stephentyrone

Description

@stephentyrone
Previous ID SR-8143
Radar rdar://problem/41735302
Original Reporter @stephentyrone
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Standard Library
Labels Bug
Assignee @stephentyrone
Priority Medium

md5: aa7632d8600c5ad6ba8cbd93aa8f3d7c

Issue Description:

Presently we have the following:

guard upperBound != 0 else { return 0 }

This seems like a pretty glaring violation of the documented behavior: "Returns a random value that is less than the given upper bound."

Metadata

Metadata

Assignees

Labels

bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.standard libraryArea: Standard library umbrella

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions