1、Designation: D 5124 96 (Reapproved 2007)Standard Practice forTesting and Use of a Random Number Generator in Lumberand Wood Products Simulation1This standard is issued under the fixed designation D 5124; the number immediately following the designation indicates the year oforiginal adoption or, in t
2、he case of revision, the year of last revision. A number in parentheses indicates the year of last reapproval. Asuperscript epsilon (e) indicates an editorial change since the last revision or reapproval.1. Scope1.1 This practice gives a minimum testing procedure ofcomputer generation routines for t
3、he standard uniform distri-bution. Random observations from the standard uniform dis-tribution, RU, range from zero to one with every value betweenzero and one having an equal chance of occurrence.1.2 The tests described in this practice only support thebasic use of random number generators, not the
4、ir use incomplex or extremely precise simulations.1.3 Simulation details for the normal, lognormal,2-parameter Weibull and 3-parameter Weibull probability dis-tributions are presented.1.4 This standard does not purport to address all of thesafety concerns, if any, associated with its use. It is ther
5、esponsibility of the user of this standard to establish appro-priate safety and health practices and determine the applica-bility of regulatory limitations prior to use. See specificwarning statement in 5.5.3.2. Referenced Documents2.1 ASTM Standards:2E 456 Terminology Relating to Quality and Statis
6、tics3. Terminology3.1 Definitions:3.1.1 periodthe number of RUdeviates the computergenerates before the sequence is repeated.3.1.2 seed valuea number required to start the computergeneration of random numbers. Depending upon the computersystem, the seed value is internally provided or it must be use
7、rspecified. Consult the documentation for the specific randomnumber generator used.3.1.3 serial correlationthe statistical correlation betweenordered observations. See 5.2.2.3.1.4 standard normal deviate, RNa computer generatedrandom observation from the normal probability distributionhaving a mean
8、equal to zero and standard deviation equal toone.3.1.5 standard uniform deviate, RUa random observationfrom the standard uniform distribution.3.1.6 standard uniform distributionthe probability distri-bution defined on the interval 0 to 1, with every value between0 and 1 having an equal chance of occ
9、urrence.3.1.7 triala computer experiment, and in this standard thegeneration and statistical test of one set of random numbers.4. Significance and Use4.1 Computer simulation is known to be a very powerfulanalytical tool for both practitioners and researchers in the areaof wood products and their app
10、lications in structural engineer-ing. Complex structural systems can be analyzed by computerwith the computer generating the system components, giventhe probability distribution of each component. Frequently thecomponents are single boards for which a compatible set ofstrength and stiffness properti
11、es are needed. However, theentire structural simulation process is dependent upon theadequacy of the standard uniform number generator required togenerate random observations from prescribed probabilitydistribution functions.4.2 The technological capabilities and wide availability ofmicrocomputers h
12、as encouraged their increased use for simu-lation studies. Tests of random number generators in com-monly available microcomputers have disclosed serious defi-ciencies (1).3Adequacy may be a function of intended end-use.This practice is concerned with generation of sets of randomnumbers, as may be r
13、equired for simulations of large popula-tions of material properties for simulation of complex struc-tures. For more demanding applications, the use of packagedand pretested random number generators is encouraged.1This practice is under the jurisdiction of ASTM Committee D07 on Wood andis the direct
14、 responsibility of Subcommittee D07.05 on Wood Assemblies.Current edition approved April 1, 2007. Published April 2007. Originallyapproved in 1991. Last previous edition approved in 2001 as D 5124 96 (2001).2For referenced ASTM standards, visit the ASTM website, www.astm.org, orcontact ASTM Customer
15、 Service at serviceastm.org. For Annual Book of ASTMStandards volume information, refer to the standards Document Summary page onthe ASTM website.3The boldface numbers in parentheses refer to the list of references at the end ofthis standard.1Copyright ASTM International, 100 Barr Harbor Drive, PO B
16、ox C700, West Conshohocken, PA 19428-2959, United States.5. Uniformity of Generated Numbers5.1 Test of the MeanThe mean of the standard uniformdistribution is12 . Generate 100 sets of 1000 random uniformnumbers and conduct the following statistical test on each set.Z 5X2 0.500.009129(1)where:Z = tes
17、t statistic,X= (RU/1000,the standard deviation is assumed to be =1/12 , andthe summation over 1000 values is implied.If the absolute value of Z exceeds 1.28 for more than 10 %and less than 30 % of the trials, the random number generatorpasses. If the random number generator fails the test using 100s
18、ets, then the number of sets can be increased or the randomnumber generator can be rejected.NOTE 1The assumption of standard deviation being equal to=1/12 may be examined with a Chi-Square test wheres 5(RU22 1000 X2!999(2)where:X= estimated means = estimated standard deviation of the 1000 RUvalues,a
19、ndthe summation over 1000 values is implied.Asignificant difference between s and =1/12, suggests anon-random generator.5.2 Test for Patterns in PairsThe purpose of this visualtest is to evaluate the tendency of pairs of deviates to formpatterns when plotted. Generate 2000 pairs of standard uniformd
20、eviates. Plot each pair of deviates on an x-y Cartesiancoordinate system. Inspect the resulting plot for signs ofpatterns, such as “strips.” Fig. 1 is one example of “stripes”generated by a BASIC function on a personal computer. Inmore than two dimensions, all generated random numbers fallmainly on
21、parallel hyperplanes, a fact discovered by Marsaglia(3).5.2.1 The following shuffling technique is an effectiveremedy for the general problem of “stripes” and randomnumbers falling on planes. Fill a 100-element array withstandard uniform deviates. Select a deviate from the arrayusing the integer por
22、tion of the product of a random deviateand 100. Replace the selected deviate with a new uniformdeviate. Repeat the process until the desired number ofdeviates has been generated. The plot of Fig. 2 resulted fromusing the shuffling technique on the random number generatorwhich produced Fig. 1.5.2.2 U
23、nless the RUgenerator is extensively tested bystringent tests (4, 5, 6) a shuffling procedure comparable to thatdescribed in 5.2.5 should be used.5.3 Visual Test for Uniform Distribution Conformance:5.3.1 The purpose of the visual test for distribution con-formance is to detect some odd behavior of
24、the random numbergenerator beyond what might be detected by the method in 5.4.It is impossible to predict the various shapes of the histogramswhich might indicate a problem with the generator. However,a few examples given here may alert the user of the generalform of a problem.5.3.2 Histogram Prepar
25、ationFig. 3 is a histogram of 1000generated standard uniform numbers. The theoretical densityfunction is a horizontal dashed line crossing the ordinate at 1.0.The interval width is 0.1. The values of the ordinates for eachinterval were calculated as follows:fi5NiWI3 T(3)where:fi= adjusted relative f
26、requency,Ni= number observed in interval i,WI= interval width, andT = total number generated.Since the interval width, WI, in this case equalled 0.1 and1000, values were generated as follows:fi5Ni0.1 3 1000(4)FIG. 1 Plotted Pairs of Random Numbers Showing “Stripes”NOTE 1The plot resulted from using
27、the shuffling technique on thegenerator which produced Fig. 1.FIG. 2 Plotted Pairs of Random Numbers with no DetectablePatternsD 5124 96 (2007)2fi5Ni100NOTE 2If different sample sizes are used, bias may exist in makingvisual interpretations from histograms. One way to lessen this bias is toapply the
28、 Sturgess Rule (7) to determine the number of cells for thehistograms.Nc5 1 1 3.3log10Ng! (5)where:Nc= number of histogram cells, andNg= number of generated numbers.5.3.3 Histogram EvaluationThe histogram of Fig. 3 has avery typical appearance for a sample as large as 1000. If onewould increase the
29、sample size, less variation in fiis expected.On the contrary, by decreasing the sample size to perhaps 50,tremendous variation in fican be expected.Aproblem would beevidenced, if for a sample size of 1000, one of the followingoccurs: (1)iffiequalled zero or near zero for one class interval,(2) if on
30、e class interval had an fivalue 50 % greater than anyother interval, or (3) if there is any noticeable trend in the fivalue such as an increase in fifrom left to right, a decrease, orwhatever. The fivalues should vary about 1.0 in a randomfashion. The data must span the entire range from 0 to 1.5.4
31、Formal Test of Distribution Conformance:5.4.1 The Kolmogorov-Smirnov (KS) goodness-of-fit testgiven in Ref (5) should be used to test the conformance of therandom numbers to the standard uniform distribution. The KStest should be conducted on 100 sets of generated randomnumber data each containing 1
32、000 observations.5.4.2 Kolmogorov-Smirnov TestGenerate the RUnumbersand store in an array. Rank the data from smallest to largest.Calculate the following:Dn15 maxFiN2 XiGi 5 1, N! (6)Dn25 maxFXi2i 2 1NGi 5 1, NDn5 maxDn1, Dn2#where:N = sample size, (1000),Xi=ithvalue of the ranked array, andDn= Kolm
33、ogorov-Smirnov (K-S) test statistic.For the test in 5.4, N equals 1000. X1is the smallest value ofthe ranked array, X2is the second smallest and so on. Dnascalculated is the largest vertical distance between the sampledensity function and the hypothesized distribution, in this casethe standard unifo
34、rm distribution. If Dnis greater than (1.07/=N ) for more than 10 % and less than 30 % of the trials, therandom number generator passes. If the generator fails the testsusing 100 sets, then the number of sets can be increased or thegenerator can be rejected.5.5 Correlations Among Generated Numbers:5
35、.5.1 The computer generated values of RUmust appear tobe random and independent. The word “appear” is used sincethe numbers are actually being generated by a mathematicalalgorithm and all such algorithms have a cycle. Provided thenumbers have the appropriate distribution function (as tested in5.3 an
36、d 5.4) and the numbers are not serially correlated, thenthe generated numbers are most useful for simulation purposes.Since the generated numbers are not truly random they areoften called “pseudo random.”5.5.2 PeriodSome personal computer brands have a uni-form number generator with an extremely sho
37、rt period depend-ing upon the seed. Some machines repeat the same sequence ofnumbers after approximately 200 numbers. Depending uponthe simulation application, the user must determine if theperiod of the machine is adequate. Reference (1) is useful forevaluating the period of various random number g
38、enerators.5.5.3 Test for Lag-1 Serial CorrelationLag-1 serial corre-lation is a measure of association between the Xiobservationand the following Xi+1. Lag-2 serial correlation is a measure ofassociation between Xiand Xi+2or all pairs of observationsseparated by one observation. In theory, it is pos
39、sible to haveany lag-k serial correlation. For random number generators, itis necessary for all lag-k to be zero for k less than the period.For k equal the period, lag-k serial correlation equals 1.0. Thefollowing statistical test from Ref. (2) is for lag-1 serialcorrelation and it is recommended as
40、 a minimum test forstatistical independence.NOTE 3Warning: Random number generators that pass the tests inthis standard can display very bad behavior in more than two dimensions.There are existing random number generators that can pass the tests in thisstandard but whose values fall on a small numbe
41、r of hyperplanes.5.5.3.1 Let Xibe an array of generated RUvalues. X1beingthe first generated, X2the second and so on. Generate 1000values of Xi. Calculate:r1! 5(XiXi 1 12 (Xi!2/1000(Xi22 (Xi!2/1000(7)where:r (1) = lag one serial correlation, and ( denotes an impliedsummation from 1 to 1000.Xi+1must
42、be replaced by X1when i equals 1000; take X1001= X1. If the calculated r (1) falls outside of the following limitsfor 0.042 r (1) 0.040 more than 10 % and less than 30 %of the trials, the random number generator passes. If theFIG. 3 Histogram of Random Numbers with Theoretical DensityFunction Superi
43、mposedD 5124 96 (2007)3random number generator fails the test using 100 sets, then thenumber of sets can be increased or the random numbergenerator can be rejected. (Assuming there is no lag-1 serialcorrelation, 20 % of the calculated r (1) values would beexpected to fall outside of the specified ra
44、nge as the numbertrials increased indefinitely.)NOTE 4Serial correlations greater than lag-1 may affect modelingprocedures. It is the responsibility of the investigator to assess, in anappropriate manner, the significance of these correlations.5.6 Selection of RUGeneratorProvided the RUgeneratorpass
45、es the tests and provisions in 5.1-5.4, it can be considereduseful for purposes of computer simulation.The tests in 5.1-5.4are considered as minimum for qualification; an individual usermay want to increase the number of trials.5.7 Rejection of RUGeneratorIn the tests of 5.1-5.4, thereis a chance of
46、 falsely rejecting a good generator. For thisreason, one may choose to repeat all tests (using different seedvalues) if a given generator failed on the first series of tests.5.8 Generation of RUIn BASIC programs the generatormay produce different results depending on whether theprogram is compiled o
47、r interpreted. On some systems consid-erable differences have been observed, between the modes,because of differences in how the generator is seeded. In anycase, the results from both methods of program executionshould be checked when using BASIC. For a comprehensivediscussion on the various methods
48、 of generating RU, Chapter 6of Ref (5) is recommended.6. Simulation from Selected Distributions6.1 Random values from a prescribed distribution will benoted by y8 which is often referred to as a random deviate. Thissection assumes that the parameters of the various probabilitydistributions have been
49、 estimated by the various methodsavailable and are now known quantities.6.2 Simulation from the Normal DistributionIn general,when simulating lumber and wood product properties from thenormal distribution, truncation is required since the normaldistribution is defined from minus infinity to plus infinity. Withsimulation it is possible to generate extremely small ornegative values. Therefore it is the responsibility of the user todiscard all values below a user specified minimum. Thedefinition of the minimum is a difficult problem. A normaldistr
copyright@ 2008-2019 麦多课文库(www.mydoc123.com)网站版权所有
备案/许可证编号:苏ICP备17064731号-1