正在加载图片...
304 Chapter 7.Random Numbers psdes(&lword,&irword); “Pseudo-DES”encode the words. itemp=jflone I (jflmsk irword); Mask to a floating number between 1 and ++(*idum); 2 return (*(float *)&itemp)-1.0; Subtraction moves range to 0.to 1. The accompanying table gives data for verifying that ran4 and psdes work correctly on your machine.We do not advise the use of ran4 unless you are able to reproduce the hex values shown. Typically,ran4 is about 4 times slower than rano (87.1),or about 3 times slower than ran1 Values for Verifying the Implementation of psdes idum before psdes call after psdes call (hex) ran4(idum) lword irword lword irword VAX PC 1 604D1DCE 509C0C23 0.275898 0.219120 99 1 99 D97F8571 A66CB41A 0.208204 0.849246 兰% -99 99 7822309D 64300984 0.034307 0.375290 99 99 g D7F376F0 59BA89EB 0.838676 0.457334 Successive calls to ran4 with arguments-1.99,-99,and 99 should produce exactly the Iword and irword values shown.Masking conversion to a returned floating random value Americ computer, is allowed to be machine dependent,values for VAX and PC are shown. Press. THE ART 9 Programs CITED REFERENCES AND FURTHER READING: Data Encryption Standard,1977 January 15,Federal Information Processing Standards Publi- cation,number 46 (Washington:U.S.Department of Commerce,National Bureau of Stan- dards).[1] Guidelines for Implementing and Using the NBS Data Encryption Standard,1981 April 1,Federal Information Processing Standards Publication,number 74(Washington:U.S.Department 8 of Commerce.National Bureau of Standards).[2] Validating the Correctness of Hardware Implementations of the NBS Data Encryption Stan- dard,1980,NBS Special Publication 500-20(Washington:U.S.Department of Commerce, National Bureau of Standards).[3] Fuurggoglrion Numerical Recipes 10-621 Meyer,C.H.and Matyas,S.M.1982,Cryptography:A New Dimension in Computer Data Security (New York:Wiley).[4] idge.org 43106 Knuth,D.E.1973,Sorting and Searching,vol.3 of The Art of Computer Programming(Reading. MA:Addison-Wesley),Chapter 6.[5] (outside Vitter,J.S.,and Chen,W-C.1987,Design and Analysis of Coalesced Hashing(New York:Oxford University Press).[6] North Software. 7.6 Simple Monte Carlo Integration Inspirations for numerical methods can spring from unlikely sources."Splines" first were flexible strips of wood used by draftsmen."Simulated annealing"(we shall see in 810.9)is rooted in a thermodynamic analogy.And who does not feel at least a faint echo of glamor in the name "Monte Carlo method"?304 Chapter 7. Random Numbers Permission is granted for internet users to make one paper copy for their own personal use. Further reproduction, or any copyin Copyright (C) 1988-1992 by Cambridge University Press. Programs Copyright (C) 1988-1992 by Numerical Recipes Software. Sample page from NUMERICAL RECIPES IN C: THE ART OF SCIENTIFIC COMPUTING (ISBN 0-521-43108-5) g of machine￾readable files (including this one) to any server computer, is strictly prohibited. To order Numerical Recipes books or CDROMs, visit website http://www.nr.com or call 1-800-872-7423 (North America only), or send email to directcustserv@cambridge.org (outside North America). psdes(&lword,&irword); “Pseudo-DES” encode the words. itemp=jflone | (jflmsk & irword); Mask to a floating number between 1 and ++(*idum); 2. return (*(float *)&itemp)-1.0; Subtraction moves range to 0. to 1. } The accompanying table gives data for verifying that ran4 and psdes work correctly on your machine. We do not advise the use of ran4 unless you are able to reproduce the hex values shown. Typically, ran4 is about 4 times slower than ran0 (§7.1), or about 3 times slower than ran1. Values for Verifying the Implementation of psdes idum before psdes call after psdes call (hex) ran4(idum) lword irword lword irword VAX PC –1 1 1 604D1DCE 509C0C23 0.275898 0.219120 99 1 99 D97F8571 A66CB41A 0.208204 0.849246 –99 99 1 7822309D 64300984 0.034307 0.375290 99 99 99 D7F376F0 59BA89EB 0.838676 0.457334 Successive calls to ran4 with arguments −1, 99, −99, and 99 should produce exactly the lword and irword values shown. Masking conversion to a returned floating random value is allowed to be machine dependent; values for VAX and PC are shown. CITED REFERENCES AND FURTHER READING: Data Encryption Standard, 1977 January 15, Federal Information Processing Standards Publi￾cation, number 46 (Washington: U.S. Department of Commerce, National Bureau of Stan￾dards). [1] Guidelines for Implementing and Using the NBS Data Encryption Standard, 1981 April 1, Federal Information Processing Standards Publication, number 74 (Washington: U.S. Department of Commerce, National Bureau of Standards). [2] Validating the Correctness of Hardware Implementations of the NBS Data Encryption Stan￾dard, 1980, NBS Special Publication 500–20 (Washington: U.S. Department of Commerce, National Bureau of Standards). [3] Meyer, C.H. and Matyas, S.M. 1982, Cryptography: A New Dimension in Computer Data Security (New York: Wiley). [4] Knuth, D.E. 1973, Sorting and Searching, vol. 3 of The Art of Computer Programming (Reading, MA: Addison-Wesley), Chapter 6. [5] Vitter, J.S., and Chen, W-C. 1987, Design and Analysis of Coalesced Hashing (New York: Oxford University Press). [6] 7.6 Simple Monte Carlo Integration Inspirations for numerical methods can spring from unlikely sources. “Splines” first were flexible strips of wood used by draftsmen. “Simulated annealing” (we shall see in §10.9) is rooted in a thermodynamic analogy. And who does not feel at least a faint echo of glamor in the name “Monte Carlo method”?
向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有