%!PS-Adobe-1.0 %%Creator: devps (Pipeline Associates, Inc.) %%CreationDate: Fri Sep 13 13:06:55 1996 %%Pages: (atend) %%DocumentFonts: (atend) /devps 180 dict def devps begin /res 10.000000 def /y_offset 843 def /X{exch}bind def /mm {transform round X round X itransform} bind def /r{rmoveto}bind def /m{moveto}bind def /l{lineto}bind def /rl{rlineto}bind def /st{stroke}bind def /gs{gsave}bind def /gr{grestore}bind def /cp{currentpoint}bind def /np{newpath}bind def /ct{curveto}bind def systemdict /setpacking known { /savepacking currentpacking def true setpacking } if /m0{0 0 moveto}bind def /xc{//res div}bind def /yc{//res neg div //y_offset add}bind def /lc{yc X xc X l st}bind def /mc{yc X xc X m}bind def /el{gs /a X def a div 1 X scale cp np a xc 2 div 0 360 arc st gr}bind def /ar{cp 7 2 roll np xc 5 1 roll atan 3 1 roll atan X arc st}bind def /sp{yc X xc X 6 2 roll yc X xc X 6 2 roll yc X xc X 6 2 roll ct}bind def /V{//res neg div //y_offset add currentpoint pop X m}bind def /H{//res div 0 transform X round X itransform pop currentpoint X pop moveto}bind def /h{//res div 0 r}bind def /v{//res neg div 0 X r}bind def /S{X H show}bind def /A{H //res div 1 index stringwidth pop sub 1 index length div 0 3 2 roll ashow}bind def /psize 10 def /height 0 def /cheight { height 0 ne { height } { psize } ifelse } bind def /slant 0 def /FF{findfont X dup 30 div 0 mm pop setlinewidth /psize X def [psize 0 cheight slant sin slant cos div mul cheight 0 0] makefont setfont}bind def /shade{gs /dy X def /dx X def np m 0 /dy rl /dx 0 rl 0 /dy neg rl /dx neg 0 rl closepath .9 setgray fill gr}bind def 1 setlinecap /resolution res 72 mul def /startFig { /SavedState save def userdict maxlength dict begin currentpoint transform DocumentInitState setmiterlimit setgray setdash setlinejoin setlinecap setlinewidth setmatrix itransform moveto /ury exch def /urx exch def /lly exch def /llx exch def /y exch 72 mul resolution div def /x exch 72 mul resolution div def currentpoint /cy exch def /cx exch def /sx x urx llx sub div def /sy y ury lly sub div def sx sy scale cx sx div llx sub cy sy div ury sub translate /DefFigCTM matrix currentmatrix def /initmatrix { DefFigCTM setmatrix } def /defaultmatrix { DefFigCTM exch copy } def /initgraphics { DocumentInitState setmiterlimit setgray setdash setlinejoin setlinecap setlinewidth setmatrix DefFigCTM setmatrix } def /showpage { initgraphics } def }bind def /clipFig { currentpoint 6 2 roll newpath 4 copy 4 2 roll moveto 6 -1 roll exch lineto exch lineto exch lineto closepath clip newpath moveto }bind def /doclip { llx lly urx ury clipFig } def /endFig { end SavedState restore }bind def /globalstart { fontnum psize slant height resolution currentpoint pagesave restore gsave }bind def /globalend { grestore moveto /resolution exch def /height exch def /slant exch def /psize exch def /fontnum exch def F /pagesave save def }bind def /fontnum 1 def systemdict /setpacking known { savepacking setpacking} if end /BP{ save mark devps begin m0 /DocumentInitState [ matrix currentmatrix currentlinewidth currentlinecap currentlinejoin currentdash currentgray currentmiterlimit ] cvx def }bind def /EP{ end cleartomark restore showpage}def /Encoding-1 256 array def 0 1 255 {Encoding-1 exch /.notdef put} for Encoding-1 8#301 StandardEncoding 8#101 26 getinterval putinterval %A-B Encoding-1 8#341 StandardEncoding 8#141 26 getinterval putinterval %a-b Encoding-1 8#241 StandardEncoding 8#301 16 getinterval putinterval %accents Encoding-1 8#373 StandardEncoding 8#365 1 getinterval putinterval %dotlessi Encoding-1 dup 8#41 /copyright put dup 8#42 /registered put dup 8#43 /trademark put dup 8#44 /logicalnot put dup 8#45 /Eth put dup 8#46 /eth put dup 8#47 /Thorn put dup 8#50 /thorn put dup 8#51 /brokenbar put dup 8#52 /degree put dup 8#53 /divide put dup 8#54 /multiply put dup 8#55 /minus put dup 8#56 /onehalf put dup 8#57 /onequarter put dup 8#60 /threequarters put dup 8#101 /Aacute put dup 8#102 /Acircumflex put dup 8#103 /Adieresis put dup 8#104 /Agrave put dup 8#105 /Aring put dup 8#106 /Atilde put dup 8#107 /Ccedilla put dup 8#110 /Eacute put dup 8#111 /Ecircumflex put dup 8#112 /Edieresis put dup 8#113 /Egrave put dup 8#114 /Iacute put dup 8#115 /Icircumflex put dup 8#116 /Idieresis put dup 8#117 /Igrave put dup 8#120 /Ntilde put dup 8#121 /Oacute put dup 8#122 /Ocircumflex put dup 8#123 /Odieresis put dup 8#124 /Ograve put dup 8#125 /Otilde put dup 8#126 /Scaron put dup 8#127 /Uacute put dup 8#130 /Ucircumflex put dup 8#131 /Udieresis put dup 8#132 /Ugrave put dup 8#133 /Ydieresis put dup 8#134 /Zcaron put dup 8#135 /aacute put dup 8#136 /acircumflex put dup 8#137 /adieresis put dup 8#140 /agrave put dup 8#141 /aring put dup 8#142 /atilde put dup 8#143 /ccedilla put dup 8#144 /eacute put dup 8#145 /ecircumflex put dup 8#146 /edieresis put dup 8#147 /egrave put dup 8#150 /iacute put dup 8#151 /icircumflex put dup 8#152 /idieresis put dup 8#153 /igrave put dup 8#154 /ntilde put dup 8#155 /oacute put dup 8#156 /ocircumflex put dup 8#157 /odieresis put dup 8#160 /ograve put dup 8#161 /otilde put dup 8#162 /scaron put dup 8#163 /uacute put dup 8#164 /ucircumflex put dup 8#165 /udieresis put dup 8#166 /ugrave put dup 8#167 /ydieresis put dup 8#170 /zcaron put pop /Enc-dict 30 dict def Enc-dict /tmpstr1 50 string put Enc-dict /tmpstr2 50 string put Enc-dict /tmpstr3 50 string dup (Encoding-) exch cvs pop put /AEnc-def { % arguments: the original font's name, encoding nr Enc-dict begin tmpstr2 cvs /Enc-no exch def % Remember the number in a string dup /OrigName exch def % remember the name findfont dup maxlength dict /newdict exch def % get dictionary for new font { exch dup /FID ne { exch newdict 3 1 roll put } { pop pop } % Ignore FID ifelse } forall newdict begin /Encoding tmpstr3 9 Enc-no putinterval tmpstr3 0 9 Enc-no length add getinterval cvn load def % Replace encoding currentdict /UniqueID known { /UniqueID UniqueID Enc-no cvi 49999 mul add def } if % Derive New UniqueID end % newdict /FNlength OrigName tmpstr1 cvs length def % convert name, remember length FNlength 1 add Enc-no length add string dup 0 OrigName tmpstr1 cvs putinterval dup FNlength (-) putinterval dup FNlength 1 add Enc-no putinterval dup 0 tmpstr1 0 FNlength getinterval putinterval % Add old name cvn dup newdict /FontName 3 2 roll put newdict definefont end % Enc-dict } def /Times-Roman 1 AEnc-def pop /R-1{/Times-Roman-1 FF}def /R{/Times-Roman FF}def /B{/Times-Bold FF}def /I{/Times-Italic FF}def /Y{/Symbol FF}def %%EndProlog %%Page: 1 1 BP /slant 0 def /height 0 def 480 V 10 R (RANDOM)448 720 A 1176(\()S 1218(3)S 1276(\))S 2696(Eighth)S (Edition)296 2989 A (RANDOM)448 4671 A 5127(\()S 5169(3)S 5227(\))S 960 V 9 R 720(N)S 722(NA)S 790(AM)S 858(ME)S 940(E)S 1080 V 10 R (random,)332 1080 A (srandom,)371 1446 A 1851(initstate,)S 2229(setstate)S 10 R-1 2560(-)S 10 R 2651(better)S (random)307 2915 A 3257(number)S 3599(generator;)S 4043(routines)S 4402(for)S 4555(changing)S 4958(genera-)S 1200 V 1080(tors)S 1368 V 9 R 720(S)S 722(SY)S 774(YN)S 842(NO)S 910(OP)S 978(PS)S 1030(SI)S 1082(IS)S 1115(S)S 1488 V 10 B 1080(#include)S 1482()S 1728 V 1080(long)S 1302(random\(void\))S 1848 V 1080(void)S 1302(srandom\(unsigned)S 10 I 2140(seed)S 10 B 2319(\))S 1968 V 1080(char)S 1314(*initstate\(unsigned)S 10 I 2170(seed)S 10 B 2349(,)S 2412(char)S 2646(*)S 10 I 2696(state)S 10 B 2886(,)S 2949(int)S 10 I 3105(n)S 10 B 3155(\))S 2088 V 1080(char)S 1314(*setstate\(char)S 1952(*)S 10 I 2002(state)S 10 B 2192(\))S 2256 V 9 R 720(D)S 722(DE)S 790(ES)S 848(SC)S 900(CR)S 962(RI)S 1024(IP)S 1057(PT)S 1109(TI)S 1167(IO)S 1200(ON)S 1268(N)S 2376 V 10 B 1080(Random)S 10 R 1484(uses)S 1692(a)S (non-linear)414 1772 A (additive)324 2221 A 2580(feedback)S (random)307 2980 A 3323(number)S 3666(generator)S 4083(employing)S 4548(a)S 4629(default)S 4945(table)S 5177(of)S 2496 V 1080(size)S 1271(31)S (long)178 1405 A 1617(integers)S 1969(to)S 2080(return)S (successive)425 2354 A (pseudo-random)625 2812 A 3470(numbers)S 3849(in)S 3960(the)S 4116(range)S 4373(from)S 4602(0)S 4685(to)S 4796(2)S 2446 V 7 R 4846(31)S 2496 V 10 Y 4916(-)S 10 R 4971(1.)S 5104(The)S 2616 V 1080(period)S 1362(of)S 1471(this)S (random)307 1641 A 1973(number)S 2305(generator)S 2711(is)S 2803(very)S 3007(large,)S 3259(approximately)S 3865(16)S 10 Y 3965(\264)S 10 R 4020(\(2)S 2566 V 7 R 4104(31)S 2616 V 10 Y 4174(-)S 10 R 4229(1\).)S 2784 V 10 B 1080(Random/srandom)S 10 R 1933(have)S 2199(\(almost\))S 2611(the)S 2810(same)S (calling)274 3093 A 3443(sequence)S 3889(and)S (initialization)509 4111 A 4697(properties)S 5177(as)S 2904 V 10 B 1080(rand/srand.)S 10 R 1616(The)S 1803(difference)S 2243(is)S 2340(that)S 10 B 2521(rand)S 10 R 2728(\(3\))S (produces)363 2876 A 3269(a)S 3344(much)S 3597(less)S (random)307 3778 A 4115(sequence)S 4514(\320)S 4644(in)S 4752(fact,)S 4958(the)S 5110(low)S 3024 V 1080(dozen)S 1347(bits)S 1519(generated)S 1938(by)S 2065(rand)S 2271(go)S (through)312 2398 A 2737(a)S 2809(cyclic)S 3077(pattern.)S 3434(All)S 3590(the)S 3740(bits)S 3912(generated)S 4331(by)S 10 B 4458(random)S 10 R 4827(are)S 4979(usable.)S 3144 V 1080(For)S 1245(example,)S (``random\(\)&01'')689 1636 A (will)157 2350 A (produce)324 2532 A 2881(a)S (random)307 2951 A 3283(binary)S 3565(value.)S 3312 V 1080(Unlike)S 10 B 1392(srand)S 10 R 1638(,)S 10 B 1701(srandom)S 10 R 2119(does)S 2341(not)S 2507(return)S 2786(the)S 2947(old)S 3113(seed;)S 3358(the)S 3519(reason)S 3820(for)S 3976(this)S 4159(is)S 4264(that)S 4453(the)S (amount)301 4614 A 4953(of)S 5076(state)S 3432 V 1080(information)S 1596(used)S 1821(is)S 1929(much)S 2193(more)S 2441(than)S 2655(a)S 2741(single)S 3022(word.)S 3320(\(Two)S 3580(other)S 3828(routines)S 4193(are)S 4358(provided)S 4756(to)S 4874(deal)S 5082(with)S 3552 V 1080(restarting/changing)S (random)307 1887 A 2224(number)S 2561(generators\).)S 3095(Like)S 10 B 3310(rand)S 10 R 3517(\(3\),)S 3690(however,)S 10 B 4092(random)S 10 R (will)157 4463 A 4651(by)S 4782(default)S 5093(pro-)S 3672 V 1080(duce)S 1295(a)S 1365(sequence)S 1759(of)S 1868(numbers)S 2239(that)S 2415(can)S 2580(be)S (duplicated)419 2700 A 3144(by)S (calling)274 3269 A 10 B 3568(srandom)S 10 R 3973(with)S 10 B 4177(1)S 10 R 4252(as)S 4361(the)S 4509(seed.)S 3840 V 1080(The)S 10 B 1262(initstate)S 10 R 1635(routine)S 1945(allows)S 2233(a)S 2303(state)S 2513(array,)S 2771(passed)S 3064(in)S 3167(as)S 3277(an)S 3398(argument,)S 3829(to)S 3933(be)S (initialized)403 4054 A 4483(for)S 4627(future)S 4894(use.)S 5104(The)S 3960 V 1080(size)S 1265(of)S 1377(the)S 1528(state)S 1741(array)S 1976(\(in)S 2115(bytes\))S 2388(is)S 2482(used)S 2693(by)S 10 B 2820(initstate)S 10 R 3195(to)S 3300(decide)S 3590(how)S (sophisticated)525 3790 A 4342(a)S (random)307 4414 A 4748(number)S 5082(gen-)S 4080 V 1080(erator)S 1343(it)S (should)267 1426 A 1720(use)S 1881(--)S 1976(the)S 2126(more)S 2360(state,)S 2597(the)S 2747(better)S 3004(the)S (random)307 3154 A 3488(numbers)S (will)157 3861 A 4045(be.)S 4217(\(Current)S 4587("optimal")S 5004(values)S 4200 V 1080(for)S 1232(the)S (amount)301 1389 A 1724(of)S 1842(state)S 2061(information)S 2570(are)S 2728(8,)S 2837(32,)S 2996(64,)S (128,)175 3155 A 3364(and)S (256)150 3543 A 3727(bytes;)S 4001(other)S (amounts)340 4241 A (will)157 4614 A 4804(be)S (rounded)329 4932 A 4320 V 1080(down)S 1331(to)S 1437(the)S 1588(nearest)S (known)273 1902 A (amount.)326 2204 A 2584(Using)S 2853(less)S 3033(than)S 3235(8)S 3314(bytes)S (will)157 3555 A 3741(cause)S 3994(an)S 4118(error\).)S 4428(The)S 4614(seed)S 4822(for)S 4969(the)S 5121(ini-)S 4440 V 1080(tialization)S 1509(\(which)S 1815(speci\256es)S 2188(a)S 2259(starting)S 2587(point)S 2819(for)S 2963(the)S (random)307 3112 A 3445(number)S 3777(sequence,)S 4196(and)S 4366(provides)S 4737(for)S 4880(restarting)S 4560 V 1080(at)S 1191(the)S 1352(same)S 1597(point\))S 1875(is)S 1980(also)S 2180(an)S 2313(argument.)S 10 B 2781(Initstate)S 10 R 3178(returns)S 3496(a)S 3579(pointer)S 3902(to)S 4018(the)S 4179(previous)S 4563(state)S 4786(information)S 4680 V 1080(array.)S 4848 V 1080(Once)S 1320(a)S 1392(state)S 1604(has)S 1766(been)S (initialized,)428 1984 A 2440(the)S 10 B 2591(setstate)S 10 R 2939(routine)S 3252(provides)S 3626(for)S 3772(rapid)S 4007(switching)S 4426(between)S 4790(states.)S 10 B 5092(Set-)S 4968 V 1080(state)S 10 R 1317(returns)S 1632(a)S 1712(pointer)S 2032(to)S 2144(the)S 2301(previous)S 2681(state)S 2900(array;)S 3170(its)S 3299(argument)S 3713(state)S 3932(array)S 4174(is)S 4275(used)S 4493(for)S 4645(further)S (random)307 4954 A 5088 V 1080(number)S 1412(generation)S (until)184 1862 A 2071(the)S 2219(next)S 2417(call)S 2588(to)S 10 B 2691(initstate)S 10 R 3064(or)S 10 B 3173(setstate)S 10 R 3493(.)S 5256 V 1080(Once)S 1319(a)S 1390(state)S 1601(array)S 1835(has)S 1996(been)S (initialized,)428 2213 A 2668(it)S 2751(may)S 2951(be)S 3073(restarted)S 3448(at)S 3548(a)S 3620(different)S 3995(point)S 4228(either)S 4485(by)S (calling)274 4612 A 10 B 4913(initstate)S 5376 V 10 R 1080(\(with)S 1321(the)S 1471(desired)S 1789(seed,)S 2020(the)S 2170(state)S 2382(array,)S 2642(and)S 2814(its)S 2936(size\))S 3154(or)S 3265(by)S (calling)274 3392 A 3693(both)S 10 B 3898(setstate)S 10 R 4245(\(with)S 4485(the)S 4635(state)S 4847(array\))S 5116(and)S 5496 V 10 B 1080(srandom)S 10 R 1489(\(with)S 1731(the)S 1883(desired)S 2203(seed\).)S 2495(The)S 2681(advantage)S 3118(of)S (calling)274 3231 A 3534(both)S 10 B 3741(setstate)S 10 R 4090(and)S 10 B 4264(srandom)S 10 R 4673(is)S 4770(that)S 4951(the)S 5104(size)S 5616 V 1080(of)S 1189(the)S 1337(state)S 1547(array)S 1780(does)S 1989(not)S 2142(have)S 2357(to)S 2460(be)S 2580(remembered)S 3109(after)S 3320(it)S 3401(is)S (initialized.)428 3493 A 5784 V 1080(With)S (256)150 1318 A 1505(bytes)S 1754(of)S 1875(state)S 2097(information,)S 2634(the)S 2794(period)S 3089(of)S 3211(the)S (random)307 3372 A 3717(number)S 4062(generator)S 4481(is)S 4586(greater)S 4905(than)S 5116(2)S 5734 V 7 R 5166(69)S 5784 V 10 R 5236(,)S 5904 V 1080(which)S (should)267 1351 A 1643(be)S 1763(suf\256cient)S 2163(for)S 2306(most)S 2526(purposes.)S 6072 V 9 R 720(A)S 722(AU)S 790(UT)S 858(TH)S 916(HO)S 984(OR)S 1052(R)S 6192 V 10 R 1080(Earl)S 1274(T.)S 1386(Cohen)S 6360 V 9 R 720(D)S 722(DI)S 790(IA)S 823(AG)S 891(GN)S 959(NO)S 1027(OS)S 1095(ST)S 1147(TI)S 1205(IC)S 1238(CS)S 1300(S)S 6480 V 10 R 1080(If)S 10 B 1173(initstate)S 10 R 1546(is)S 1638(called)S 1904(with)S 2108(less)S 2284(than)S 2483(8)S 2559(bytes)S 2797(of)S 2907(state)S 3118(information,)S 3644(or)S 3754(if)S 10 B 3842(setstate)S 10 R 4188(detects)S 4494(that)S 4671(the)S 4820(state)S 5031(infor-)S 6600 V 1080(mation)S 1384(has)S 1543(been)S 1758(garbled,)S 2110(error)S 2332(messages)S 2737(are)S 2886(printed)S 3196(on)S 3321(the)S 3469(standard)S 3835(error)S 4057(output.)S 6768 V 9 R 720(S)S 722(SE)S 774(EE)S 832(E)S 913(A)S 915(AL)S 983(LS)S 1041(SO)S 1093(O)S 6888 V 10 B 1080(rand)S 10 R 1287(\(3\).)S 7056 V 9 R 720(N)S 722(NO)S 790(OT)S 858(TE)S 916(ES)S 974(S)S 7176 V 10 B 1080(initstate)S 10 R 1466(and)S 10 B 1650(setstate)S 10 R 2009(are)S 2172(not)S 2339(declared)S 2720(in)S 10 I 2837()S 10 R 3279(,)S 3343(programmers)S 3919(must)S 4153(provide)S 4499(their)S 4723(own)S 4935(declara-)S 7296 V 1080(tions.)S 7903 V 720(Page)S 941(1)S 2545(\()S 2587(September)S 3043(29,)S (1985)200 3193 A 3401(\))S 4455(September)S 4911(13,)S (1996)200 5061 A 8143 V EP %%Page: 2 2 BP /slant 0 def /height 0 def 480 V 10 R (RANDOM)448 720 A 1176(\()S 1218(3)S 1276(\))S 2696(Eighth)S (Edition)296 2989 A (RANDOM)448 4671 A 5127(\()S 5169(3)S 5227(\))S 960 V 9 R 720(B)S 722(BU)S 784(UG)S 852(GS)S 920(S)S 1080 V 10 R (About)251 1080 A 1356(2/3)S 1509(the)S 1657(speed)S 1911(of)S 10 B 2020(rand)S 10 R 2227(\(3\).)S 7903 V 720(September)S 1176(13,)S (1996)200 1326 A 2545(\()S 2587(September)S 3043(29,)S (1985)200 3193 A 3401(\))S 4990(Page)S 5211(2)S 8143 V EP %%Trailer %%DocumentFonts: Times-Roman Times-Bold Times-Italic Symbol %%Pages: 2