Skip to content

Commit 032740f

Browse files
use crypto.randomInt for port generation
1 parent a30d209 commit 032740f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/libraries/Port.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
import { randomInt } from "crypto"
2+
13
export function GenerateRandomPort() {
2-
return Math.floor(Math.random() * (65535 - 1024) + 1025)
4+
//Min is inclusive and max is exclusive. Inclusive range would be 1025 - 65535
5+
return randomInt(1025, 65536)
36
}

0 commit comments

Comments
 (0)