From 066d75beeb51fb95c7912086f547643b11a2b65f Mon Sep 17 00:00:00 2001 From: allen91wu Date: Wed, 1 Dec 2021 17:08:28 +0800 Subject: [PATCH 1/2] Translate library/random.po part.1 --- library/random.po | 54 +++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 45 insertions(+), 9 deletions(-) diff --git a/library/random.po b/library/random.po index caed168093..b0b2376293 100644 --- a/library/random.po +++ b/library/random.po @@ -3,13 +3,14 @@ # This file is distributed under the same license as the Python package. # # Translators: +# Allen Wu , 2021 msgid "" msgstr "" "Project-Id-Version: Python 3.10\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-10-26 16:47+0000\n" -"PO-Revision-Date: 2018-05-23 16:09+0000\n" -"Last-Translator: Adrian Liaw \n" +"PO-Revision-Date: 2021-12-06 20:10+0800\n" +"Last-Translator: Allen Wu \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" "Language: zh_TW\n" @@ -17,10 +18,11 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: Poedit 3.0\n" #: ../../library/random.rst:2 msgid ":mod:`random` --- Generate pseudo-random numbers" -msgstr "" +msgstr ":mod:`random` --- 生成偽隨機數" #: ../../library/random.rst:7 msgid "**Source code:** :source:`Lib/random.py`" @@ -30,7 +32,7 @@ msgstr "**原始碼:**\\ :source:`Lib/random.py`" msgid "" "This module implements pseudo-random number generators for various " "distributions." -msgstr "" +msgstr "本章中所提及的 module(模組)用來實現各種分佈的虛擬隨機數產生器。" #: ../../library/random.rst:14 msgid "" @@ -39,6 +41,8 @@ msgid "" "permutation of a list in-place, and a function for random sampling without " "replacement." msgstr "" +"對於整數,可以從範圍中進行均勻選擇。對於序列,有一個隨機元素的均勻選擇,一個用來原地 (in-place) 產生隨機排列清" +"單的函式,以及一個用來隨機採樣不替換的函式。" #: ../../library/random.rst:19 msgid "" @@ -46,6 +50,8 @@ msgid "" "lognormal, negative exponential, gamma, and beta distributions. For " "generating distributions of angles, the von Mises distribution is available." msgstr "" +"在實數線上,有一些函式用於處理均勻分佈、常態分佈(高斯分佈)、對數常態分佈、負指數分佈、gamma " +"分佈和 Beta 分佈。對於生成角度分佈,可以使用馮·米塞斯分佈 (von Mises distribution)。" #: ../../library/random.rst:23 msgid "" @@ -58,6 +64,11 @@ msgid "" "However, being completely deterministic, it is not suitable for all " "purposes, and is completely unsuitable for cryptographic purposes." msgstr "" +"幾乎所有 module 函式都相依於基本函式 :func:`.random`,此函式在半開放範圍 [0.0, 1.0) 內均勻地" +"生成一個隨機 float(浮點數)。Python 使用 Mersenne Twister(梅森旋轉演算法)作為核心的產生" +"器,它產生 53 位元精度 float,其週期為 2\\*\\*19937-1,透過 C 語言進行底層的實作既快速又" +"支援執行緒安全 (threadsafe)。Mersenne Twister 是現存最廣泛被驗證的隨機數產生器之一,但是基於完全確定性,它並不適合所" +"有目的,並且完全不適合加密目的。" #: ../../library/random.rst:32 msgid "" @@ -65,6 +76,8 @@ msgid "" "instance of the :class:`random.Random` class. You can instantiate your own " "instances of :class:`Random` to get generators that don't share state." msgstr "" +"該 module 提供的函式實際上是 :class:`random.Random` class(類別)中一個隱藏實例的綁定方" +"法 (bound method)。你可以實例化自己的 :class:`Random` 實例,以得到不共享狀態的產生器。" #: ../../library/random.rst:36 msgid "" @@ -75,6 +88,10 @@ msgid "" "`~Random.getrandbits` method --- this allows :meth:`randrange` to produce " "selections over an arbitrarily large range." msgstr "" +"如果你想使用你自己設計的基本產生器,\\ :class:`Random` 也可以進行子類別化 (subclass):在這種情況" +"下,要覆蓋 :meth:`~Random.random`、\\ :meth:`~Random.seed`、\\ :meth:`~Random.getstate` 和 :meth:" +"`~Random.setstate` 的方式。你也可以為新的產生器提供 :meth:`~Random.getrandbits` 方法 --- 這允" +"許 :meth:`randrange` 在任意大的範圍內產生選擇。" #: ../../library/random.rst:42 msgid "" @@ -82,12 +99,16 @@ msgid "" "uses the system function :func:`os.urandom` to generate random numbers from " "sources provided by the operating system." msgstr "" +":mod:`random` module 也提供了 :class:`SystemRandom` class,使用系統函數 :func:`os.urandom` 從" +"作業系統提供的來源產生隨機數。" #: ../../library/random.rst:48 msgid "" "The pseudo-random generators of this module should not be used for security " "purposes. For security or cryptographic uses, see the :mod:`secrets` module." msgstr "" +"本章所提及的虛擬隨機數產生器不應該使用於安全目的。有關安全性或加密用途,請參考 :mod:" +"`secrets` module。" #: ../../library/random.rst:54 msgid "" @@ -95,6 +116,9 @@ msgid "" "equidistributed uniform pseudorandom number generator\", ACM Transactions on " "Modeling and Computer Simulation Vol. 8, No. 1, January pp.3--30 1998." msgstr "" +"M. Matsumoto and T. Nishimura, \"Mersenne Twister: A 623-dimensionally " +"equidistributed uniform pseudorandom number generator\", ACM Transactions on " +"Modeling and Computer Simulation Vol. 8, No. 1, January pp.3--30 1998." #: ../../library/random.rst:59 msgid "" @@ -102,14 +126,16 @@ msgid "" "recipes/576707/>`_ for a compatible alternative random number generator with " "a long period and comparatively simple update operations." msgstr "" +"\"進位互補乘法 (Complementary-Multiply-with-Carry) 用法\"_\\ ,可作為隨機" +"數產生器的一個可相容替代方案,具有較長的週期和相對簡單的更新操作。" #: ../../library/random.rst:66 msgid "Bookkeeping functions" -msgstr "" +msgstr "簿記函式 (bookkeeping functions)" #: ../../library/random.rst:70 msgid "Initialize the random number generator." -msgstr "" +msgstr "初始化隨機數產生器。" #: ../../library/random.rst:72 msgid "" @@ -118,10 +144,12 @@ msgid "" "instead of the system time (see the :func:`os.urandom` function for details " "on availability)." msgstr "" +"如果 *a* 被省略或為 ``None``,則使用當前系統時間。如果隨機來源由作業系統提供,則使用它們而不是系統時" +"間(有關可用性的詳細資訊,請參考 :func:`os.urandom` 函式)。" #: ../../library/random.rst:77 msgid "If *a* is an int, it is used directly." -msgstr "" +msgstr "如果 *a* 為 int(整數),則直接使用它。" #: ../../library/random.rst:79 msgid "" @@ -129,6 +157,8 @@ msgid "" "`bytearray` object gets converted to an :class:`int` and all of its bits are " "used." msgstr "" +"如使用版本 2(預設值),:class:`str`、:class:`bytes` 或 :class:`bytearray` 物件將轉換為 :class:" +"`int`,並使用其所有位元。" #: ../../library/random.rst:82 msgid "" @@ -136,11 +166,13 @@ msgid "" "versions of Python), the algorithm for :class:`str` and :class:`bytes` " "generates a narrower range of seeds." msgstr "" +"若使用版本 1(為復現於舊版本 Python 中產生隨機序列而提供),:class:`str` 和 :class:`bytes` 的演算法會生" +"成範圍更窄的種子 (seed)。" #: ../../library/random.rst:86 msgid "" "Moved to the version 2 scheme which uses all of the bits in a string seed." -msgstr "" +msgstr "移至版本 2 方案,該方案使用字串種子中的所有位元。" #: ../../library/random.rst:89 msgid "" @@ -148,12 +180,14 @@ msgid "" "class:`int`, :class:`float`, :class:`str`, :class:`bytes`, or :class:" "`bytearray`." msgstr "" +"將來,*seed* 必須是以下型別之一:*NoneType*、:class:`int`、:class:`float`、:class:`str`、:" +"class:`bytes` 或 :class:`bytearray`。" #: ../../library/random.rst:96 msgid "" "Return an object capturing the current internal state of the generator. " "This object can be passed to :func:`setstate` to restore the state." -msgstr "" +msgstr "回傳一個物件,捕獲產生器的當前內部狀態。此物件可以傳遞給 :func:`setstate` 以恢復狀態。" #: ../../library/random.rst:102 msgid "" @@ -161,6 +195,8 @@ msgid "" "and :func:`setstate` restores the internal state of the generator to what it " "was at the time :func:`getstate` was called." msgstr "" +"*state* 應該要從之前對 :func:`getstate` 的呼叫中獲得,並且以 :func:`setstate` 將產生器的內部狀" +"態恢復到呼叫 :func:`getstate` 時的狀態。" #: ../../library/random.rst:108 msgid "Functions for bytes" From 7a6d8a122ec589c5b559ec3ecc0bc74b2e5ac72c Mon Sep 17 00:00:00 2001 From: "Matt.Wang" Date: Mon, 6 Dec 2021 23:47:22 +0800 Subject: [PATCH 2/2] chore(library/random): format the file --- library/random.po | 73 ++++++++++++++++++++++++++--------------------- 1 file changed, 41 insertions(+), 32 deletions(-) diff --git a/library/random.po b/library/random.po index b0b2376293..1c42b42c95 100644 --- a/library/random.po +++ b/library/random.po @@ -41,8 +41,9 @@ msgid "" "permutation of a list in-place, and a function for random sampling without " "replacement." msgstr "" -"對於整數,可以從範圍中進行均勻選擇。對於序列,有一個隨機元素的均勻選擇,一個用來原地 (in-place) 產生隨機排列清" -"單的函式,以及一個用來隨機採樣不替換的函式。" +"對於整數,可以從範圍中進行均勻選擇。對於序列,有一個隨機元素的均勻選擇,一個" +"用來原地 (in-place) 產生隨機排列清單的函式,以及一個用來隨機採樣不替換的函" +"式。" #: ../../library/random.rst:19 msgid "" @@ -50,8 +51,9 @@ msgid "" "lognormal, negative exponential, gamma, and beta distributions. For " "generating distributions of angles, the von Mises distribution is available." msgstr "" -"在實數線上,有一些函式用於處理均勻分佈、常態分佈(高斯分佈)、對數常態分佈、負指數分佈、gamma " -"分佈和 Beta 分佈。對於生成角度分佈,可以使用馮·米塞斯分佈 (von Mises distribution)。" +"在實數線上,有一些函式用於處理均勻分佈、常態分佈(高斯分佈)、對數常態分佈、" +"負指數分佈、gamma 分佈和 Beta 分佈。對於生成角度分佈,可以使用馮·米塞斯分佈 " +"(von Mises distribution)。" #: ../../library/random.rst:23 msgid "" @@ -64,11 +66,12 @@ msgid "" "However, being completely deterministic, it is not suitable for all " "purposes, and is completely unsuitable for cryptographic purposes." msgstr "" -"幾乎所有 module 函式都相依於基本函式 :func:`.random`,此函式在半開放範圍 [0.0, 1.0) 內均勻地" -"生成一個隨機 float(浮點數)。Python 使用 Mersenne Twister(梅森旋轉演算法)作為核心的產生" -"器,它產生 53 位元精度 float,其週期為 2\\*\\*19937-1,透過 C 語言進行底層的實作既快速又" -"支援執行緒安全 (threadsafe)。Mersenne Twister 是現存最廣泛被驗證的隨機數產生器之一,但是基於完全確定性,它並不適合所" -"有目的,並且完全不適合加密目的。" +"幾乎所有 module 函式都相依於基本函式 :func:`.random`,此函式在半開放範圍 " +"[0.0, 1.0) 內均勻地生成一個隨機 float(浮點數)。Python 使用 Mersenne " +"Twister(梅森旋轉演算法)作為核心的產生器,它產生 53 位元精度 float,其週期" +"為 2\\*\\*19937-1,透過 C 語言進行底層的實作既快速又支援執行緒安全 " +"(threadsafe)。Mersenne Twister 是現存最廣泛被驗證的隨機數產生器之一,但是基於" +"完全確定性,它並不適合所有目的,並且完全不適合加密目的。" #: ../../library/random.rst:32 msgid "" @@ -76,8 +79,9 @@ msgid "" "instance of the :class:`random.Random` class. You can instantiate your own " "instances of :class:`Random` to get generators that don't share state." msgstr "" -"該 module 提供的函式實際上是 :class:`random.Random` class(類別)中一個隱藏實例的綁定方" -"法 (bound method)。你可以實例化自己的 :class:`Random` 實例,以得到不共享狀態的產生器。" +"該 module 提供的函式實際上是 :class:`random.Random` class(類別)中一個隱藏實" +"例的綁定方法 (bound method)。你可以實例化自己的 :class:`Random` 實例,以得到" +"不共享狀態的產生器。" #: ../../library/random.rst:36 msgid "" @@ -88,10 +92,11 @@ msgid "" "`~Random.getrandbits` method --- this allows :meth:`randrange` to produce " "selections over an arbitrarily large range." msgstr "" -"如果你想使用你自己設計的基本產生器,\\ :class:`Random` 也可以進行子類別化 (subclass):在這種情況" -"下,要覆蓋 :meth:`~Random.random`、\\ :meth:`~Random.seed`、\\ :meth:`~Random.getstate` 和 :meth:" -"`~Random.setstate` 的方式。你也可以為新的產生器提供 :meth:`~Random.getrandbits` 方法 --- 這允" -"許 :meth:`randrange` 在任意大的範圍內產生選擇。" +"如果你想使用你自己設計的基本產生器,\\ :class:`Random` 也可以進行子類別化 " +"(subclass):在這種情況下,要覆蓋 :meth:`~Random.random`、\\ :meth:`~Random." +"seed`、\\ :meth:`~Random.getstate` 和 :meth:`~Random.setstate` 的方式。你也可" +"以為新的產生器提供 :meth:`~Random.getrandbits` 方法 --- 這允許 :meth:" +"`randrange` 在任意大的範圍內產生選擇。" #: ../../library/random.rst:42 msgid "" @@ -99,16 +104,16 @@ msgid "" "uses the system function :func:`os.urandom` to generate random numbers from " "sources provided by the operating system." msgstr "" -":mod:`random` module 也提供了 :class:`SystemRandom` class,使用系統函數 :func:`os.urandom` 從" -"作業系統提供的來源產生隨機數。" +":mod:`random` module 也提供了 :class:`SystemRandom` class,使用系統函數 :" +"func:`os.urandom` 從作業系統提供的來源產生隨機數。" #: ../../library/random.rst:48 msgid "" "The pseudo-random generators of this module should not be used for security " "purposes. For security or cryptographic uses, see the :mod:`secrets` module." msgstr "" -"本章所提及的虛擬隨機數產生器不應該使用於安全目的。有關安全性或加密用途,請參考 :mod:" -"`secrets` module。" +"本章所提及的虛擬隨機數產生器不應該使用於安全目的。有關安全性或加密用途,請參" +"考 :mod:`secrets` module。" #: ../../library/random.rst:54 msgid "" @@ -126,8 +131,9 @@ msgid "" "recipes/576707/>`_ for a compatible alternative random number generator with " "a long period and comparatively simple update operations." msgstr "" -"\"進位互補乘法 (Complementary-Multiply-with-Carry) 用法\"_\\ ,可作為隨機" -"數產生器的一個可相容替代方案,具有較長的週期和相對簡單的更新操作。" +"`進位互補乘法 (Complementary-Multiply-with-Carry) 用法 `_\\ ,可作為隨機數產生器的一個可相容替代方" +"案,具有較長的週期和相對簡單的更新操作。" #: ../../library/random.rst:66 msgid "Bookkeeping functions" @@ -144,8 +150,9 @@ msgid "" "instead of the system time (see the :func:`os.urandom` function for details " "on availability)." msgstr "" -"如果 *a* 被省略或為 ``None``,則使用當前系統時間。如果隨機來源由作業系統提供,則使用它們而不是系統時" -"間(有關可用性的詳細資訊,請參考 :func:`os.urandom` 函式)。" +"如果 *a* 被省略或為 ``None``,則使用當前系統時間。如果隨機來源由作業系統提" +"供,則使用它們而不是系統時間(有關可用性的詳細資訊,請參考 :func:`os." +"urandom` 函式)。" #: ../../library/random.rst:77 msgid "If *a* is an int, it is used directly." @@ -157,8 +164,8 @@ msgid "" "`bytearray` object gets converted to an :class:`int` and all of its bits are " "used." msgstr "" -"如使用版本 2(預設值),:class:`str`、:class:`bytes` 或 :class:`bytearray` 物件將轉換為 :class:" -"`int`,並使用其所有位元。" +"如使用版本 2(預設值),:class:`str`、:class:`bytes` 或 :class:`bytearray` 物" +"件將轉換為 :class:`int`,並使用其所有位元。" #: ../../library/random.rst:82 msgid "" @@ -166,8 +173,8 @@ msgid "" "versions of Python), the algorithm for :class:`str` and :class:`bytes` " "generates a narrower range of seeds." msgstr "" -"若使用版本 1(為復現於舊版本 Python 中產生隨機序列而提供),:class:`str` 和 :class:`bytes` 的演算法會生" -"成範圍更窄的種子 (seed)。" +"若使用版本 1(為復現於舊版本 Python 中產生隨機序列而提供),:class:`str` 和 :" +"class:`bytes` 的演算法會生成範圍更窄的種子 (seed)。" #: ../../library/random.rst:86 msgid "" @@ -180,14 +187,16 @@ msgid "" "class:`int`, :class:`float`, :class:`str`, :class:`bytes`, or :class:" "`bytearray`." msgstr "" -"將來,*seed* 必須是以下型別之一:*NoneType*、:class:`int`、:class:`float`、:class:`str`、:" -"class:`bytes` 或 :class:`bytearray`。" +"將來,*seed* 必須是以下型別之一:*NoneType*、:class:`int`、:class:`float`、:" +"class:`str`、:class:`bytes` 或 :class:`bytearray`。" #: ../../library/random.rst:96 msgid "" "Return an object capturing the current internal state of the generator. " "This object can be passed to :func:`setstate` to restore the state." -msgstr "回傳一個物件,捕獲產生器的當前內部狀態。此物件可以傳遞給 :func:`setstate` 以恢復狀態。" +msgstr "" +"回傳一個物件,捕獲產生器的當前內部狀態。此物件可以傳遞給 :func:`setstate` 以" +"恢復狀態。" #: ../../library/random.rst:102 msgid "" @@ -195,8 +204,8 @@ msgid "" "and :func:`setstate` restores the internal state of the generator to what it " "was at the time :func:`getstate` was called." msgstr "" -"*state* 應該要從之前對 :func:`getstate` 的呼叫中獲得,並且以 :func:`setstate` 將產生器的內部狀" -"態恢復到呼叫 :func:`getstate` 時的狀態。" +"*state* 應該要從之前對 :func:`getstate` 的呼叫中獲得,並且以 :func:" +"`setstate` 將產生器的內部狀態恢復到呼叫 :func:`getstate` 時的狀態。" #: ../../library/random.rst:108 msgid "Functions for bytes"