📄 testresults.sh
字号:
#!/bin/sh# testResults.sh# Examine the output from test of random number generators# Explain the meaning in plain Englishgrep -A 200 "integer generation:" testWagner.out | tail -200 > tmpWagnerInt.outgrep -A 200 -F "[0,1) generation:" testWagner.out | tail -200 > tmpWagnerExc.outgrep -A 200 -F "[0,1] generation:" testWagner.out | tail -200 > tmpWagnerInc.outgrep -A 200 "integer generation:" testOrig.out | tail -200 > tmpOrigInt.outgrep -A 200 -F "[0,1) generation:" testOrig.out | tail -200 > tmpOrigExc.outgrep -A 200 -F "[0,1] generation:" testOrig.out | tail -200 > tmpOrigInc.outgrep -A 200 "genrand_int32()" mt19937ar.out | tail -200 > tmpRefInt.outgrep -A 200 -F "genrand_real2()" mt19937ar.out | tail -200 > tmpRefExc.outrm -f tmpDiffLocal.out tmpDiffRef.out tmpError.outdiff --brief tmpWagnerInt.out tmpOrigInt.out | tee -a tmpDiffLocal.outdiff --brief tmpWagnerExc.out tmpOrigExc.out | tee -a tmpDiffLocal.outdiff --brief tmpWagnerInc.out tmpOrigInc.out | tee -a tmpDiffLocal.outdiff -b --brief tmpWagnerInt.out tmpRefInt.out | tee -a tmpDiffRef.outdiff -b --brief tmpWagnerExc.out tmpRefExc.out | tee -a tmpDiffRef.outgrep "Error" testWagner.out | tee tmpError.outechoecho "Rate of Mersenne Twister random integer generation:"printf " MersenneTwister.h (this C++ class) "gawk '/Time elapsed/{ printf( "%4.1f million per second\n", 300 / $4 ) }' testWagner.outprintf " Inventors' revised C version "gawk '/Time elapsed/{ printf( "%4.1f million per second\n", 300 / $4 ) }' testOrig.outprintf " Cokus's optimized C version "gawk '/Time elapsed/{ printf( "%4.1f million per second\n", 300 / $4 ) }' testCokus.outprintf " Hinsch's C++ class "gawk '/Time elapsed/{ printf( "%4.1f million per second (non-standard seeding)\n", 300 / $4 ) }' testHinsch.outprintf " Standard rand() "gawk '/Time elapsed/{ printf( "%4.1f million per second (non-MT)\n", 300 / $4 ) }' testStd.outechofailLocal=falsefailRef=falseif [ -s tmpDiffLocal.out ]; then failLocal=truefiif [ -s tmpDiffRef.out ] || [ -s tmpError.out ]; then failRef=truefiif [ $failLocal = "true" ] || [ $failRef = "true" ]; then if [ $failRef = "true" ]; then cat testWagner.out testOrig.out > bug.out echo "Failed tests - MersenneTwister.h generated incorrect output" echo "Results have been written to a file called 'bug.out'" echo "Please send a copy of 'bug.out' and system info to rjwagner@writeme.com" else echo "Inventors' revised C version failed" echo "MersenneTwister.h passed and is safe to use" fielse echo "Passed all tests"fiexit 0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -