Skip to content

Random.randRange when low = hi #313

@dlicata335

Description

@dlicata335

Version

110.99.4

Operating System

  • Any
  • Linux
  • macOS
  • Windows
  • Other Unix

OS Version

Catalina

Processor

  • Any
  • Arm (using Rosetta)
  • PowerPC
  • Sparc
  • x86 (32-bit)
  • x86-64 (64-bit)
  • Other

System Component

SML/NJ Library

Severity

Minor

Description

I think the behavior of Random.randRange has changed in the past year (since I last used a homework that suddenly had a bug), and is inconsistent with the documentation. The documentation says "val randRange : (int * int) -> rand -> int
randRange (lo, hi) rand generates a random number in the [lo..hi]. This function will raise the Fail exception if hi < lo." This suggests one should be able to call it with low = hi (and necessarily get low=hi as the output). However,

Random.randRange (1,1) (Random.rand(1,2));

raises Div.

Transcript

No response

Expected Behavior

No response

Steps to Reproduce

Random.randRange (1,1) (Random.rand(1,2));

Additional Information

No response

Email address

dlicata@wesleyan.edu

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingfixed-in-110.99.6issues that will be fixed in the 110.99.6 versionsmlnj-libGeneral issue with the SML/NJ Library or the Util component

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions