From 79c6e052ed29b9b78c31f2e01da3b91f76b6a017 Mon Sep 17 00:00:00 2001 From: Suguru Motegi Date: Mon, 24 Feb 2020 13:37:15 -0800 Subject: fix: createSecKey logic (#4063) --- std/ws/mod.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'std/ws/mod.ts') diff --git a/std/ws/mod.ts b/std/ws/mod.ts index 5a8f0bd2e..3128a88b5 100644 --- a/std/ws/mod.ts +++ b/std/ws/mod.ts @@ -457,7 +457,7 @@ const kSecChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-.~_"; export function createSecKey(): string { let key = ""; for (let i = 0; i < 16; i++) { - const j = Math.round(Math.random() * kSecChars.length); + const j = Math.floor(Math.random() * kSecChars.length); key += kSecChars[j]; } return btoa(key); -- cgit v1.2.3