From f45e9e070c93ebbd83d488bdd775987a4d75c201 Mon Sep 17 00:00:00 2001 From: t7yang Date: Mon, 10 Jan 2022 08:38:08 +0800 Subject: fix yari h2m dry run errors --- .../global_objects/math/random/index.html | 25 +++++++--------------- 1 file changed, 8 insertions(+), 17 deletions(-) (limited to 'files/zh-tw/web/javascript/reference/global_objects/math/random') diff --git a/files/zh-tw/web/javascript/reference/global_objects/math/random/index.html b/files/zh-tw/web/javascript/reference/global_objects/math/random/index.html index 6731d1c2b4..8087d30bfd 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/math/random/index.html +++ b/files/zh-tw/web/javascript/reference/global_objects/math/random/index.html @@ -10,8 +10,8 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Math/random

函數 Math.random() 會回傳一個偽隨機小數 (pseudo-random) 介於0到1之間(包含 0,不包含1) ,大致符合數學與統計上的均勻分佈 (uniform distribution) ,您可以選定想要的數字區間,它會透過演算法被產生並且不允許使用者自行跳選或重設成特定數字。{{EmbedInteractiveExample("pages/js/math-random.html")}}

-
-

Math.random() 所產生的偽隨機小數不符合加密學安全性要求。請勿使用於任何加密、資安相關領域。

+
+

備註:Math.random() 所產生的偽隨機小數不符合加密學安全性要求。請勿使用於任何加密、資安相關領域。

如有加密需求建議參考Web Crypto APIwindow.crypto.getRandomValues()

@@ -55,8 +55,8 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Math/random } -
-

It might be tempting to use Math.round() to accomplish that, but doing so would cause your random numbers to follow a non-uniform distribution, which may not be acceptable for your needs.

+
+

Note: might be tempting to use Math.round() to accomplish that, but doing so would cause your random numbers to follow a non-uniform distribution, which may not be acceptable for your needs.

Getting a random integer between two values, inclusive

@@ -69,24 +69,15 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Math/random return Math.floor(Math.random() * (max - min + 1) + min); //The maximum is inclusive and the minimum is inclusive } -

Specifications

+

規範

- - - - - - - - - -
Specification
{{SpecName('ESDraft', '#sec-math.random', 'Math.random')}}
+{{Specifications}}

瀏覽器相容性

-

{{Compat("javascript.builtins.Math.random")}}

+{{Compat}} -

其他參考資料

+

其他參考資料