Skip to content

Commit 91f9166

Browse files
authored
Random:NextNumber() clarifications (#920)
## Changes <!-- Please summarize your changes. --> math.random() explicitly mentions that exactly zero can be returned by reading it with basic number knowledge. However, Random:NextNumber() requires developers to know numerical range notation to determine that NextNumber can return exactly zero. Apply the math.random() standard to Random:NextNumber(). <!-- Please link to any applicable information (forum posts, bug reports, etc.). --> [Found out about this in a hard way. Would like this post to be deleted due to me being embarassed by it](https://devforum.roblox.com/t/random-nextnumber-should-never-return-zero/3270962) ## Checks By submitting your pull request for review, you agree to the following: - [X] This contribution was created in whole or in part by me, and I have the right to submit it under the terms of this repository's open source licenses. - [X] I understand and agree that this contribution and a record of it are public, maintained indefinitely, and may be redistributed under the terms of this repository's open source licenses. - [X] To the best of my knowledge, all proposed changes are accurate.
1 parent f3c6051 commit 91f9166

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

content/en-us/reference/engine/datatypes/Random.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ methods:
5555
summary: |
5656
Returns a pseudorandom number uniformly distributed over `[0, 1]`.
5757
description: |
58-
Returns a pseudorandom number uniformly distributed over `[0, 1]`.
58+
Returns a uniform pseudorandom real number in the range of 0 to 1,
59+
inclusive.
5960
parameters:
6061
returns:
6162
- type: number
@@ -67,7 +68,8 @@ methods:
6768
summary: |
6869
Returns a pseudorandom number uniformly distributed over `[min, max]`.
6970
description: |
70-
Returns a pseudorandom number uniformly distributed over `[min, max]`.
71+
Returns a uniform pseudorandom real number in the range of `min` to
72+
`max`, inclusive.
7173
parameters:
7274
- name: min
7375
type: number

0 commit comments

Comments
 (0)