fbpx
维基百科

線性同餘方法

線性同餘方法(LCG)是個產生偽隨機數的方法。

它是根據以下的遞迴關係式

其中是產生器設定的常數。

LCG的週期最大為,但大部分情況都會少於M。要令LCG達到最大週期,應符合以下條件:

  1. 互質
  2. 的所有質因數都能整除
  3. 是4的倍數也是;
  4. 都比小;
  5. 是正整數。

随机性

因为通过线性同余方法构建的伪随机数生成器的内部状态可以轻易地由其输出演算得知,所以此种伪随机数生成器属于统计学伪随机数生成器。

设计密码学的应用必须至少使用密码学安全伪随机数生成器,故需要避免由线性同余方法获得的随机数在密码学中的应用。

參見

參考文獻

  • S.K. Park and K.W. Miller. Random Number Generators: Good Ones Are Hard To Find. Communications of the ACM. 1988, 31 (10): 1192–1201. doi:10.1145/63039.63042. 
  • D. E. Knuth. The Art of Computer Programming, Volume 2: Seminumerical Algorithms, Third Edition. Addison-Wesley, 1997. ISBN 0-201-89684-2. Section 3.2.1: The Linear Congruential Method, pp. 10–26.
  • P. L'Ecuyer. Tables of Linear Congruential Generators of Different Sizes and Good Lattice Structure. Mathematics of Computation. 1999, 68 (225): 249–260 [2012-12-30]. doi:10.1090/S0025-5718-99-00996-5. (原始内容于2005-05-16). 
  • Press, WH; Teukolsky, SA; Vetterling, WT; Flannery, BP, Section 7.1.1. Some History, Numerical Recipes: The Art of Scientific Computing 3rd, New York: Cambridge University Press, 2007 [2012-12-30], ISBN 978-0-521-88068-8, (原始内容于2011-08-11) 
  • Gentle, James E., (2003). Random Number Generation and Monte Carlo Methods, 2nd edition, Springer, ISBN 0-387-00178-6.
  • Joan Boyar. Inferring sequences produced by pseudo-random number generators. Journal of the ACM. 1989, 36 (1): 129–141. doi:10.1145/58562.59305.  (in this paper, efficient algorithms are given for inferring sequences produced by certain pseudo-random number generators).

外部連結

  • The simulation Linear Congruential Generator (页面存档备份,存于互联网档案馆) visualizes the correlations between the pseudo-random numbers when manipulating the parameters.
  • The "Death of Art" computer art project at Goldstein Technologies LLC, uses an LCG to generate 33,554,432 images (页面存档备份,存于互联网档案馆
  • P. L'Ecuyer and R. Simard, ``TestU01: A C Library for Empirical Testing of Random Number Generators, May 2006, Revised November 2006, ACM Transactions on Mathematical Software, 33, 4, Article 22, August 2007. (页面存档备份,存于互联网档案馆

線性同餘方法, 此條目已列出參考文獻, 但因為沒有文內引註而使來源仍然不明, 2014年9月16日, 请加上合适的文內引註来改善这篇条目, 是個產生偽隨機數的方法, 它是根據以下的遞迴關係式, displaystyle, equiv, times, pmod, 其中a, displaystyle, 是產生器設定的常數, lcg的週期最大為m, displaystyle, 但大部分情況都會少於m, 要令lcg達到最大週期, 應符合以下條件, displaystyle, 互質, displaystyle, 的所有質因數. 此條目已列出參考文獻 但因為沒有文內引註而使來源仍然不明 2014年9月16日 请加上合适的文內引註来改善这篇条目 線性同餘方法 LCG 是個產生偽隨機數的方法 它是根據以下的遞迴關係式 N j 1 A N j B mod M displaystyle N j 1 equiv A times N j B pmod M 其中A B M displaystyle A B M 是產生器設定的常數 LCG的週期最大為M displaystyle M 但大部分情況都會少於M 要令LCG達到最大週期 應符合以下條件 B M displaystyle B M 互質 M displaystyle M 的所有質因數都能整除A 1 displaystyle A 1 若M displaystyle M 是4的倍數 A 1 displaystyle A 1 也是 A B N 0 displaystyle A B N 0 都比M displaystyle M 小 A B displaystyle A B 是正整數 目录 1 随机性 2 參見 3 參考文獻 4 外部連結随机性 编辑因为通过线性同余方法构建的伪随机数生成器的内部状态可以轻易地由其输出演算得知 所以此种伪随机数生成器属于统计学伪随机数生成器 设计密码学的应用必须至少使用密码学安全伪随机数生成器 故需要避免由线性同余方法获得的随机数在密码学中的应用 參見 编辑Mersenne Twister參考文獻 编辑S K Park and K W Miller Random Number Generators Good Ones Are Hard To Find Communications of the ACM 1988 31 10 1192 1201 doi 10 1145 63039 63042 D E Knuth The Art of Computer Programming Volume 2 Seminumerical Algorithms Third Edition Addison Wesley 1997 ISBN 0 201 89684 2 Section 3 2 1 The Linear Congruential Method pp 10 26 P L Ecuyer Tables of Linear Congruential Generators of Different Sizes and Good Lattice Structure Mathematics of Computation 1999 68 225 249 260 2012 12 30 doi 10 1090 S0025 5718 99 00996 5 原始内容存档于2005 05 16 Press WH Teukolsky SA Vetterling WT Flannery BP Section 7 1 1 Some History Numerical Recipes The Art of Scientific Computing 3rd New York Cambridge University Press 2007 2012 12 30 ISBN 978 0 521 88068 8 原始内容存档于2011 08 11 Gentle James E 2003 Random Number Generation and Monte Carlo Methods 2nd edition Springer ISBN 0 387 00178 6 Joan Boyar Inferring sequences produced by pseudo random number generators Journal of the ACM 1989 36 1 129 141 doi 10 1145 58562 59305 in this paper efficient algorithms are given for inferring sequences produced by certain pseudo random number generators 外部連結 编辑The simulation Linear Congruential Generator 页面存档备份 存于互联网档案馆 visualizes the correlations between the pseudo random numbers when manipulating the parameters Security of Random Number Generation An Annotated Bibliography Linear Congruential Generators post to sci math The Death of Art computer art project at Goldstein Technologies LLC uses an LCG to generate 33 554 432 images 页面存档备份 存于互联网档案馆 P L Ecuyer and R Simard TestU01 A C Library for Empirical Testing of Random Number Generators May 2006 Revised November 2006 ACM Transactions on Mathematical Software 33 4 Article 22 August 2007 页面存档备份 存于互联网档案馆 Additive Congruential Method maths and logic behind its spread 取自 https zh wikipedia org w index php title 線性同餘方法 amp oldid 74359717, 维基百科,wiki,书籍,书籍,图书馆,

文章

,阅读,下载,免费,免费下载,mp3,视频,mp4,3gp, jpg,jpeg,gif,png,图片,音乐,歌曲,电影,书籍,游戏,游戏。