Skip to content

Commit e7be04d

Browse files
adhi2714zth
authored andcommitted
doc strings and examples added
1 parent 6899a33 commit e7be04d

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

src/Core__Math.resi

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,37 @@ module Int: {
277277
@val
278278
external sign: int => int = "Math.sign"
279279

280+
/**
281+
floor(v) returns the largest `int` less than or equal to the argument;
282+
the result is pinned to the range of the `int` data type: -2147483648 to 2147483647.
283+
See [`Math.floor`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/floor)
284+
on MDN.
285+
286+
## Examples
287+
288+
```rescript
289+
Math.Int.floor(3.7) == 3
290+
Math.Int.floor(3.0) == 3
291+
Math.Int.floor(-3.1) == -4
292+
Math.Int.floor(-1.0e15) == -2147483648
293+
Math.Int.floor(1.0e15) == 2147483647
294+
```
295+
*/
280296
let floor: float => int
297+
298+
/**
299+
`random(minVal, maxVal)` returns a random integer number in the half-closed interval [minVal, maxVal).
300+
See [`Math.random`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/random)
301+
on MDN.
302+
303+
## Examples
304+
305+
```rescript
306+
Math.Int.random(2, 5) == 4
307+
Math.Int.random(505, 2000) == 1276
308+
Math.Int.random(-7, -2) == -4
309+
```
310+
*/
281311
let random: (int, int) => int
282312
}
283313

0 commit comments

Comments
 (0)