|
999 | 999 | <method name="randf"> |
1000 | 1000 | <return type="float" /> |
1001 | 1001 | <description> |
1002 | | - Returns a random floating point value between [code]0.0[/code] and [code]1.0[/code] (inclusive). |
| 1002 | + Returns a random floating-point value between [code]0.0[/code] and [code]1.0[/code] (inclusive). |
1003 | 1003 | [codeblocks] |
1004 | 1004 | [gdscript] |
1005 | 1005 | randf() # Returns e.g. 0.375671 |
|
1015 | 1015 | <param index="0" name="from" type="float" /> |
1016 | 1016 | <param index="1" name="to" type="float" /> |
1017 | 1017 | <description> |
1018 | | - Returns a random floating point value between [param from] and [param to] (inclusive). |
| 1018 | + Returns a random floating-point value between [param from] and [param to] (inclusive). |
1019 | 1019 | [codeblocks] |
1020 | 1020 | [gdscript] |
1021 | 1021 | randf_range(0, 20.5) # Returns e.g. 7.45315 |
|
1033 | 1033 | <param index="0" name="mean" type="float" /> |
1034 | 1034 | <param index="1" name="deviation" type="float" /> |
1035 | 1035 | <description> |
1036 | | - Returns a normally-distributed pseudo-random floating point value using Box-Muller transform with the specified [param mean] and a standard [param deviation]. This is also called Gaussian distribution. |
| 1036 | + Returns a [url=https://en.wikipedia.org/wiki/Normal_distribution]normally-distributed[/url], pseudo-random floating-point value from the specified [param mean] and a standard [param deviation]. This is also known as a Gaussian distribution. |
| 1037 | + [b]Note:[/b] This method uses the [url=https://en.wikipedia.org/wiki/Box%E2%80%93Muller_transform]Box-Muller transform[/url] algorithm. |
1037 | 1038 | </description> |
1038 | 1039 | </method> |
1039 | 1040 | <method name="randi"> |
|
1261 | 1262 | <param index="0" name="x" type="Variant" /> |
1262 | 1263 | <param index="1" name="step" type="Variant" /> |
1263 | 1264 | <description> |
1264 | | - Returns the multiple of [param step] that is the closest to [param x]. This can also be used to round a floating point number to an arbitrary number of decimals. |
| 1265 | + Returns the multiple of [param step] that is the closest to [param x]. This can also be used to round a floating-point number to an arbitrary number of decimals. |
1265 | 1266 | The returned value is the same type of [Variant] as [param step]. Supported types: [int], [float], [Vector2], [Vector2i], [Vector3], [Vector3i], [Vector4], [Vector4i]. |
1266 | 1267 | [codeblock] |
1267 | 1268 | snapped(100, 32) # Returns 96 |
|
1278 | 1279 | <param index="0" name="x" type="float" /> |
1279 | 1280 | <param index="1" name="step" type="float" /> |
1280 | 1281 | <description> |
1281 | | - Returns the multiple of [param step] that is the closest to [param x]. This can also be used to round a floating point number to an arbitrary number of decimals. |
| 1282 | + Returns the multiple of [param step] that is the closest to [param x]. This can also be used to round a floating-point number to an arbitrary number of decimals. |
1282 | 1283 | A type-safe version of [method snapped], returning a [float]. |
1283 | 1284 | [codeblock] |
1284 | 1285 | snappedf(32.0, 2.5) # Returns 32.5 |
|
0 commit comments