Skip to content

Commit 947a3a9

Browse files
committed
Update documentation
1 parent 2efc916 commit 947a3a9

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

README.md

+35
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,37 @@
11
# gm_securerandom
22
A module for generating secure random numbers and strings in Garry's Mod
3+
4+
## API
5+
6+
#### random.Bytes(size)
7+
8+
* size (number) - A whole number representing the amount of bytes you want returned
9+
10+
Generates `size` bytes and returns them as a string.
11+
12+
#### random.Number([min, max])
13+
14+
* min (number, optional, default 0) - The minimum value to generate
15+
* max (number, optional, default 1) - The maximum value to generate
16+
17+
Generates a number between `min` and `max` and returns it.
18+
19+
## Usage
20+
21+
#### Random bytes
22+
```lua
23+
require("securerandom")
24+
print(util.Base64Encode(random.Bytes(16)))
25+
```
26+
27+
#### Random number between 0 and 1
28+
```lua
29+
require("securerandom")
30+
print(random.Number())
31+
```
32+
33+
#### Random number between 5 and 10.5
34+
```lua
35+
require("securerandom")
36+
print(random.Number(5, 10.5))
37+
```

0 commit comments

Comments
 (0)