随机数是指从某个特定分布中随机选择的数字,选择大量这样的数字可以重现潜在的分布。几乎总是,这些数字还被要求是独立的,以便连续的数字之间没有相关性。计算机生成的随机数有时被称为伪随机数,而术语“随机”则保留给不可预测的物理过程的输出。当不加限定地使用时,“随机”一词通常意味着“具有均匀分布的随机”。当然,其他分布也是可能的。例如,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)
|
所以
![C=(n+1)/(x_1^(n+1)-x_0^(n+1)).](/images/equations/RandomNumber/NumberedEquation2.svg) |
(2)
|
设
是
上的均匀分布变量。那么
且变量由下式给出
分布为
。
另请参阅
Bays' Shuffle,
Box-Muller 变换,
Cliff 随机数生成器,
准随机序列,
随机变量,
Schrage 算法,
随机,
均匀分布
使用 Wolfram|Alpha 探索
参考文献
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.在 Wolfram|Alpha 上引用
随机数
请引用为
Weisstein, Eric W. "随机数。" 来自 MathWorld--Wolfram Web 资源。 https://mathworld.net.cn/RandomNumber.html
主题分类