Jump to content

Linear congruential generator: Difference between revisions

→‎{{header|Picat}}: Split info subsections. Added {{out}}
(→‎{{header|Picat}}: Split info subsections. Added {{out}})
Line 2,546:
 
=={{header|Picat}}==
===Methods as hard coded predicates===
First the two methods as specific procedures.
<lang Picat>go =>
 
Line 2,579:
M.put(ms_state,Rand).</lang>
 
{{out}}
Output:
<pre>bsd = [12345,1406932606,654583775,1449466924,229283573,1109335178,1051550459,1293799192,794471793,551188310]
bsd2 = [1103527590,377401575,662824084,1147902781,2035015474,368800899,1508029952,486256185,1062517886,267834847]
Line 2,585:
ms2 = [41,18467,6334,26500,19169,15724,11478,29358,26962,24464]</pre>
 
===Generalized version===
Then as generalized versions (using global map).
Using a global global map for setting/setting seeds etc.
<lang Picat>go2 =>
 
Line 2,624 ⟶ 2,625:
get_global_map().put(Type,M).</lang>
 
{{out}}
Output:
<pre>[12345,1406932606,654583775,1449466924,229283573,1109335178,1051550459,1293799192,794471793,551188310]
[1103527590,377401575,662824084,1147902781,2035015474,368800899,1508029952,486256185,1062517886,267834847]
Line 2,630 ⟶ 2,631:
[41,18467,6334,26500,19169,15724,11478,29358,26962,24464]
*** lcg(unknown,unknown_LCG_type)</pre>
 
 
=={{header|PicoLisp}}==
495

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.