3
3
# This file is distributed under the same license as the Python package.
4
4
#
5
5
# Translators:
6
+ # Allen Wu <allen91.wu@gmail.com>, 2021
6
7
msgid ""
7
8
msgstr ""
8
9
"Project-Id-Version :Python 3.10\n "
9
10
"Report-Msgid-Bugs-To :\n "
10
11
"POT-Creation-Date :2021-10-26 16:47+0000\n "
11
- "PO-Revision-Date :2018-05-23 16:09+0000 \n "
12
- "Last-Translator :Adrian Liaw <adrianliaw2000 @gmail.com>\n "
12
+ "PO-Revision-Date :2021-12-06 20:10+0800 \n "
13
+ "Last-Translator :Allen Wu <allen91.wu @gmail.com>\n "
13
14
"Language-Team :Chinese - TAIWAN (https://github.com/python/python-docs-zh- "
14
15
"tw)\n "
15
16
"Language :zh_TW\n "
16
17
"MIME-Version :1.0\n "
17
18
"Content-Type :text/plain; charset=UTF-8\n "
18
19
"Content-Transfer-Encoding :8bit\n "
19
20
"Plural-Forms :nplurals=1; plural=0;\n "
21
+ "X-Generator :Poedit 3.0\n "
20
22
21
23
#: ../../library/random.rst:2
22
24
msgid ":mod:`random` --- Generate pseudo-random numbers"
23
- msgstr ""
25
+ msgstr ":mod:`random` --- 生成偽隨機數 "
24
26
25
27
#: ../../library/random.rst:7
26
28
msgid "**Source code:** :source:`Lib/random.py`"
@@ -30,7 +32,7 @@ msgstr "**原始碼:**\\ :source:`Lib/random.py`"
30
32
msgid ""
31
33
"This module implements pseudo-random number generators for various "
32
34
"distributions."
33
- msgstr ""
35
+ msgstr "本章中所提及的 module(模組)用來實現各種分佈的虛擬隨機數產生器。 "
34
36
35
37
#: ../../library/random.rst:14
36
38
msgid ""
@@ -39,13 +41,19 @@ msgid ""
39
41
"permutation of a list in-place, and a function for random sampling without "
40
42
"replacement."
41
43
msgstr ""
44
+ "對於整數,可以從範圍中進行均勻選擇。對於序列,有一個隨機元素的均勻選擇,一個"
45
+ "用來原地 (in-place) 產生隨機排列清單的函式,以及一個用來隨機採樣不替換的函"
46
+ "式。"
42
47
43
48
#: ../../library/random.rst:19
44
49
msgid ""
45
50
"On the real line, there are functions to compute uniform, normal (Gaussian), "
46
51
"lognormal, negative exponential, gamma, and beta distributions. For "
47
52
"generating distributions of angles, the von Mises distribution is available."
48
53
msgstr ""
54
+ "在實數線上,有一些函式用於處理均勻分佈、常態分佈(高斯分佈)、對數常態分佈、"
55
+ "負指數分佈、gamma 分佈和 Beta 分佈。對於生成角度分佈,可以使用馮·米塞斯分佈 "
56
+ "(von Mises distribution)。"
49
57
50
58
#: ../../library/random.rst:23
51
59
msgid ""
@@ -58,13 +66,22 @@ msgid ""
58
66
"However, being completely deterministic, it is not suitable for all "
59
67
"purposes, and is completely unsuitable for cryptographic purposes."
60
68
msgstr ""
69
+ "幾乎所有 module 函式都相依於基本函式 :func:`.random`,此函式在半開放範圍 "
70
+ "[0.0, 1.0) 內均勻地生成一個隨機 float(浮點數)。Python 使用 Mersenne "
71
+ "Twister(梅森旋轉演算法)作為核心的產生器,它產生 53 位元精度 float,其週期"
72
+ "為 2\\ *\\ *19937-1,透過 C 語言進行底層的實作既快速又支援執行緒安全 "
73
+ "(threadsafe)。Mersenne Twister 是現存最廣泛被驗證的隨機數產生器之一,但是基於"
74
+ "完全確定性,它並不適合所有目的,並且完全不適合加密目的。"
61
75
62
76
#: ../../library/random.rst:32
63
77
msgid ""
64
78
"The functions supplied by this module are actually bound methods of a hidden "
65
79
"instance of the :class:`random.Random` class. You can instantiate your own "
66
80
"instances of :class:`Random` to get generators that don't share state."
67
81
msgstr ""
82
+ "該 module 提供的函式實際上是 :class:`random.Random` class(類別)中一個隱藏實"
83
+ "例的綁定方法 (bound method)。你可以實例化自己的 :class:`Random` 實例,以得到"
84
+ "不共享狀態的產生器。"
68
85
69
86
#: ../../library/random.rst:36
70
87
msgid ""
@@ -75,41 +92,56 @@ msgid ""
75
92
"`~Random.getrandbits` method --- this allows :meth:`randrange` to produce "
76
93
"selections over an arbitrarily large range."
77
94
msgstr ""
95
+ "如果你想使用你自己設計的基本產生器,\\ :class:`Random` 也可以進行子類別化 "
96
+ "(subclass):在這種情況下,要覆蓋 :meth:`~Random.random`、\\ :meth:`~Random."
97
+ "seed`、\\ :meth:`~Random.getstate` 和 :meth:`~Random.setstate` 的方式。你也可"
98
+ "以為新的產生器提供 :meth:`~Random.getrandbits` 方法 --- 這允許 :meth:"
99
+ "`randrange` 在任意大的範圍內產生選擇。"
78
100
79
101
#: ../../library/random.rst:42
80
102
msgid ""
81
103
"The :mod:`random` module also provides the :class:`SystemRandom` class which "
82
104
"uses the system function :func:`os.urandom` to generate random numbers from "
83
105
"sources provided by the operating system."
84
106
msgstr ""
107
+ ":mod:`random` module 也提供了 :class:`SystemRandom` class,使用系統函數 :"
108
+ "func:`os.urandom` 從作業系統提供的來源產生隨機數。"
85
109
86
110
#: ../../library/random.rst:48
87
111
msgid ""
88
112
"The pseudo-random generators of this module should not be used for security "
89
113
"purposes. For security or cryptographic uses, see the :mod:`secrets` module."
90
114
msgstr ""
115
+ "本章所提及的虛擬隨機數產生器不應該使用於安全目的。有關安全性或加密用途,請參"
116
+ "考 :mod:`secrets` module。"
91
117
92
118
#: ../../library/random.rst:54
93
119
msgid ""
94
120
"M. Matsumoto and T. Nishimura,\" Mersenne Twister: A 623-dimensionally "
95
121
"equidistributed uniform pseudorandom number generator\" , ACM Transactions on "
96
122
"Modeling and Computer Simulation Vol. 8, No. 1, January pp.3--30 1998."
97
123
msgstr ""
124
+ "M. Matsumoto and T. Nishimura,\" Mersenne Twister: A 623-dimensionally "
125
+ "equidistributed uniform pseudorandom number generator\" , ACM Transactions on "
126
+ "Modeling and Computer Simulation Vol. 8, No. 1, January pp.3--30 1998."
98
127
99
128
#: ../../library/random.rst:59
100
129
msgid ""
101
130
"`Complementary-Multiply-with-Carry recipe <https://code.activestate.com/"
102
131
"recipes/576707/>`_ for a compatible alternative random number generator with "
103
132
"a long period and comparatively simple update operations."
104
133
msgstr ""
134
+ "`進位互補乘法 (Complementary-Multiply-with-Carry) 用法 <https://code."
135
+ "activestate.com/recipes/576707/>`_\\ ,可作為隨機數產生器的一個可相容替代方"
136
+ "案,具有較長的週期和相對簡單的更新操作。"
105
137
106
138
#: ../../library/random.rst:66
107
139
msgid "Bookkeeping functions"
108
- msgstr ""
140
+ msgstr "簿記函式 (bookkeeping functions) "
109
141
110
142
#: ../../library/random.rst:70
111
143
msgid "Initialize the random number generator."
112
- msgstr ""
144
+ msgstr "初始化隨機數產生器。 "
113
145
114
146
#: ../../library/random.rst:72
115
147
msgid ""
@@ -118,49 +150,62 @@ msgid ""
118
150
"instead of the system time (see the :func:`os.urandom` function for details "
119
151
"on availability)."
120
152
msgstr ""
153
+ "如果 *a* 被省略或為 ``None``,則使用當前系統時間。如果隨機來源由作業系統提"
154
+ "供,則使用它們而不是系統時間(有關可用性的詳細資訊,請參考 :func:`os."
155
+ "urandom` 函式)。"
121
156
122
157
#: ../../library/random.rst:77
123
158
msgid "If *a* is an int, it is used directly."
124
- msgstr ""
159
+ msgstr "如果 *a* 為 int(整數),則直接使用它。 "
125
160
126
161
#: ../../library/random.rst:79
127
162
msgid ""
128
163
"With version 2 (the default), a :class:`str`, :class:`bytes`, or :class:"
129
164
"`bytearray` object gets converted to an :class:`int` and all of its bits are "
130
165
"used."
131
166
msgstr ""
167
+ "如使用版本 2(預設值),:class:`str`、:class:`bytes` 或 :class:`bytearray` 物"
168
+ "件將轉換為 :class:`int`,並使用其所有位元。"
132
169
133
170
#: ../../library/random.rst:82
134
171
msgid ""
135
172
"With version 1 (provided for reproducing random sequences from older "
136
173
"versions of Python), the algorithm for :class:`str` and :class:`bytes` "
137
174
"generates a narrower range of seeds."
138
175
msgstr ""
176
+ "若使用版本 1(為復現於舊版本 Python 中產生隨機序列而提供),:class:`str` 和 :"
177
+ "class:`bytes` 的演算法會生成範圍更窄的種子 (seed)。"
139
178
140
179
#: ../../library/random.rst:86
141
180
msgid ""
142
181
"Moved to the version 2 scheme which uses all of the bits in a string seed."
143
- msgstr ""
182
+ msgstr "移至版本 2 方案,該方案使用字串種子中的所有位元。 "
144
183
145
184
#: ../../library/random.rst:89
146
185
msgid ""
147
186
"In the future, the *seed* must be one of the following types: *NoneType*, :"
148
187
"class:`int`, :class:`float`, :class:`str`, :class:`bytes`, or :class:"
149
188
"`bytearray`."
150
189
msgstr ""
190
+ "將來,*seed* 必須是以下型別之一:*NoneType*、:class:`int`、:class:`float`、:"
191
+ "class:`str`、:class:`bytes` 或 :class:`bytearray`。"
151
192
152
193
#: ../../library/random.rst:96
153
194
msgid ""
154
195
"Return an object capturing the current internal state of the generator. "
155
196
"This object can be passed to :func:`setstate` to restore the state."
156
197
msgstr ""
198
+ "回傳一個物件,捕獲產生器的當前內部狀態。此物件可以傳遞給 :func:`setstate` 以"
199
+ "恢復狀態。"
157
200
158
201
#: ../../library/random.rst:102
159
202
msgid ""
160
203
"*state* should have been obtained from a previous call to :func:`getstate`, "
161
204
"and :func:`setstate` restores the internal state of the generator to what it "
162
205
"was at the time :func:`getstate` was called."
163
206
msgstr ""
207
+ "*state* 應該要從之前對 :func:`getstate` 的呼叫中獲得,並且以 :func:"
208
+ "`setstate` 將產生器的內部狀態恢復到呼叫 :func:`getstate` 時的狀態。"
164
209
165
210
#: ../../library/random.rst:108
166
211
msgid "Functions for bytes"