隨機數是指從某個特定分佈中隨機選擇的數字,選擇大量這樣的數字可以重現潛在的分佈。幾乎總是,這些數字還被要求是獨立的,以便連續的數字之間沒有相關性。計算機生成的隨機數有時被稱為偽隨機數,而術語“隨機”則保留給不可預測的物理過程的輸出。當不加限定地使用時,“隨機”一詞通常意味著“具有均勻分佈的隨機”。當然,其他分佈也是可能的。例如,Box-Muller 變換允許將成對的均勻隨機數轉換為具有二維正態分佈的相應隨機數。
不可能生成任意長的隨機數字字串並證明它是隨機的。奇怪的是,人類也很難生成隨機數字字串,並且可以編寫計算機程式,這些程式平均而言實際上可以根據之前的數字預測人類將寫下的一些數字。
有許多常用的方法用於生成偽隨機數,其中最簡單的方法是線性同餘法。另一種簡單而優雅的方法是元胞自動機規則 30,其中心列由 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, ... (OEIS A051023) 給出,它提供了 Wolfram 語言中用於大整數的隨機數生成器。大多數隨機數生成器需要指定一個用作起點的初始數字,這被稱為“種子”。可以透過檢查其噪聲球來分析給定演算法生成的隨機數的優劣。
當在某個指定的邊界上生成隨機數時,通常需要對分佈進行歸一化,以便每個微分面積都被均勻填充。例如,從均勻分佈中選取
和
不能給出球體點拾取的均勻分佈。
為了從均勻分佈
生成冪律分佈
,對於
,寫成
。然後歸一化給出
![int_(x_0)^(x_1)P(x)dx=C([x^(n+1)]_(x_0)^(x_1))/(n+1)=1,](/images/equations/RandomNumber/NumberedEquation1.svg) |
(1)
|
所以
 |
(2)
|
設
是
上的均勻分佈變數。那麼
且變數由下式給出
分佈為
。
另請參閱
Bays' Shuffle,
Box-Muller 變換,
Cliff 隨機數生成器,
準隨機序列,
隨機變數,
Schrage 演算法,
隨機,
均勻分佈
使用 探索
參考文獻
Bassein, S. "A Sampler of Randomness." Amer. Math. Monthly 103, 483-490, 1996.Bennett, D. J. Randomness. Cambridge, MA: Harvard University Press, 1998.Bratley, P.; Fox, B. L.; and Schrage, E. L. A Guide to Simulation, 2nd ed. New York: Springer-Verlag, 1996.Dahlquist, G. and Bjorck, A. Ch. 11 in Numerical Methods. Englewood Cliffs, NJ: Prentice-Hall, 1974.Deak, I. Random Number Generators and Simulation. New York: State Mutual Book & Periodical Service, 1990.Evans, M.; Hastings, N.; and Peacock, B. Statistical Distributions, 3rd ed. New York: Wiley, p. 5, 2000.Forsythe, G. E.; Malcolm, M. A.; and Moler, C. B. Ch. 10 in Computer Methods for Mathematical Computations. Englewood Cliffs, NJ: Prentice-Hall, 1977.Gardner, M. "Random Numbers." Ch. 13 in Mathematical Carnival: A New Round-Up of Tantalizers and Puzzles from Scientific American. New York: Vintage, pp. 161-172, 1977.James, F. "A Review of Pseudorandom Number Generators." Computer Physics Comm. 60, 329-344, 1990.Kac, M. "What is Random?" Amer. Sci. 71, 405-406, 1983.Kenney, J. F. and Keeping, E. S. Mathematics of Statistics, Pt. 1, 3rd ed. Princeton, NJ: Van Nostrand, pp. 200-201 and 205-207, 1962.Kenney, J. F. and Keeping, E. S. Mathematics of Statistics, Pt. 2, 2nd ed. Princeton, NJ: Van Nostrand, pp. 151-154, 1951.Knuth, D. E. Ch. 3 in The Art of Computer Programming, Vol. 2: Seminumerical Algorithms, 3rd ed. Reading, MA: Addison-Wesley, 1998.Marsaglia, G. "A Current View of Random Number Generators." In Computer Science and Statistics: Proceedings of the Symposium on the Interface, 16th, Atlanta, Georgia, March 1984 (Ed. L. Billard). New York: Elsevier, 1985.Marsaglia, G. "DIEHARD: A Battery of Tests for Random Number Generators." http://stat.fsu.edu/~geo/diehard.html.Mascagni, M. "Random Numbers on the Web." http://archive.ncsa.uiuc.edu/Apps/CMP/RNG/mascagni/www-rng.html.Niederreiter, H. Random Number Generation and Quasi-Monte Carlo Methods. Philadelphia, PA: SIAM, 1992.Nijenhuis, A. and Wilf, H. Combinatorial Algorithms for Computers and Calculators, 2nd ed. New York: Academic Press, 1978.Park, S. and Miller, K. "Random Number Generators: Good Ones are Hard to Find." Comm. ACM 31, 1192-1201, 1988.Peterson, I. The Jungles of Randomness: A Mathematical Safari. New York: Wiley, 1997.Pickover, C. A. "Computers, Randomness, Mind, and Infinity." Ch. 31 in Keys to Infinity. New York: W. H. Freeman, pp. 233-247, 1995.Press, W. H.; Flannery, B. P.; Teukolsky, S. A.; and Vetterling, W. T. "Random Numbers." Ch. 7 in Numerical Recipes in FORTRAN: The Art of Scientific Computing, 2nd ed. Cambridge, England: Cambridge University Press, pp. 266-306, 1992.Schrage, L. "A More Portable Fortran Random Number Generator." ACM Trans. Math. Software 5, 132-138, 1979.Schroeder, M. "Random Number Generators." In Number Theory in Science and Communication, with Applications in Cryptography, Physics, Digital Information, Computing and Self-Similarity, 3rd ed. New York: Springer-Verlag, pp. 289-295, 1990.Sloane, N. J. A. Sequence A051023 in "The On-Line Encyclopedia of Integer Sequences."Weisstein, E. W. "Books about Randomness." http://www.ericweisstein.com/encyclopedias/books/Randomness.html.Wilf, H. S. Combinatorial Algorithms: An Update. Philadelphia, PA: SIAM, 1989.在 上引用
隨機數
請引用為
Weisstein, Eric W. "隨機數。" 來自 Web 資源。 https://mathworld.tw/RandomNumber.html
主題分類