Skip to content

Commit 8792bbc

Browse files
Elijah Kotyluk-ButlerElijahKotyluk
authored andcommitted
docs(RandomInt): add comments describing the remaining randomInt methods.
1 parent 708ad70 commit 8792bbc

File tree

1 file changed

+30
-0
lines changed
  • packages/graalvm/src/main/kotlin/elide/runtime/intrinsics/js/node

1 file changed

+30
-0
lines changed

packages/graalvm/src/main/kotlin/elide/runtime/intrinsics/js/node/CryptoAPI.kt

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,39 @@ import elide.vm.annotations.Polyglot
4646
*/
4747
public fun randomInt(min: Int = 0, max: Int, callback: RandomIntCallback? = null): Any
4848

49+
/**
50+
* ## Crypto: randomInt
51+
* Generates a cryptographically secure random integer between the specified `min` (inclusive) and `max` (exclusive) values.
52+
*
53+
* See also: [Node Crypto API: `randomInt`](https://nodejs.org/api/crypto.html#cryptorandomintmin-max-callback)
54+
*
55+
* @param min
56+
* @param max
57+
* @param callback
58+
* @return A randomly generated integer between `min` (inclusive) and `max` (exclusive) or nothing if a callback was provided.
59+
*/
4960
@Polyglot public fun randomInt(min: Value?, max: Value, callback: Value?): Any
5061

62+
/**
63+
* ## Crypto: randomInt
64+
* Generates a cryptographically secure random integer between the specified `min` (inclusive) and `max` (exclusive) values.
65+
*
66+
* See also: [Node Crypto API: `randomInt`](https://nodejs.org/api/crypto.html#cryptorandomintmin-max-callback)
67+
*
68+
* @param max
69+
* @param callback
70+
* @return A randomly generated integer between `0` (inclusive) and `max` (exclusive) or nothing if a callback was provided.
71+
*/
5172
@Polyglot public fun randomInt(max: Value, callback: Value?): Any
5273

74+
/**
75+
* ## Crypto: randomInt
76+
* Generates a cryptographically secure random integer between the specified `min` (inclusive) and `max` (exclusive) values.
77+
*
78+
* See also: [Node Crypto API: `randomInt`](https://nodejs.org/api/crypto.html#cryptorandomintmin-max-callback)
79+
*
80+
* @param max
81+
* @return A randomly generated integer between `0` (inclusive) and `max` (exclusive).
82+
*/
5383
@Polyglot public fun randomInt(max: Value): Any
5484
}

0 commit comments

Comments
 (0)