| |
|
|
p.specht
| withal the -zigtausendfach better performance heutiger computer systems to whom Großrechnern the 1960-iger years there mathematical Problems (z.B. Optimierungsaufgaben), The yet always not reiner Rechenkraft entire resolved go can. then is one on undertow. "Monte-Carlo-Methoden" dependent: one zieht (How in the berühmten Spielcasino) statistisch Zufallsstichproben and closes from it the zugrunde liegende behaviour the Gesamtsystems.
Voraussetzunng is, that one leistungsfähiger, possible same-verteilter Zufallsgenerator available standing - gleichverteilt, because the Generator self Yes otherwise The Results verzerren would. but too The Number of ziehbaren Stichproben goes into Aussagekraft the Ergebnisses one - we need means a VERY SCHNELLEN, enough detailed and AUSGEZEICHNET GLEICHVERTEILTEN Zufallsgenerator. the relating itself though only on Single precision Floatingpoint.
P.s.: which RND()-Algorithmus in XProfan verbaut is white I unfortunately not.
Window Title "Einfacher, faster Single Precision pseudo-Random Generator"
' Rechtliches: Teilauszug from ACM-Algo. Nr. 359 by John Burghardt
' details and Referenzen see Appendix below! OHNE GEWÄHR!
Cls
declare seed&
seed&=12345
print
print " SOLL 12345 0.096616 207482415"
print seed&,r_uniform_01(),seed&
print
print " SOLL 207482415 0.833995 1790989824"
print seed&,r_uniform_01(),seed&
print
print " SOLL 1790989824 0.947702 2035175616"
print seed&,r_uniform_01(),seed&
print
waitinput
End
Proc r_uniform_01
DECLARE k&,r_uniform_01!'extern_global: seed&
k& = seed& \ 127773
seed&= 16807*(seed&-k&*127773)-k&*2836
case seed&<0:seed&=seed&+2147483647
return seed&*val("4.656612875e-10")
endproc
' *******************************************************************************
' R_UNIFORM_01 returns a unit SINGLE PRECISION pseudorandom number.
' Diese routine implements the recursion
' seed = 16807 * seed mod (2^31-1)
' r_uniform_01 = seed/(2^31-1)
' The integer arithmetic never requires more than 32 bits including a sign bit.
'
' If the initial seed is 12345, then the first three computations are
' Input output R_UNIFORM_01
' SEED SEED
' 12345 207482415 0.096616
' 207482415 1790989824 0.833995
' 1790989824 2035175616 0.947702
'
' Modified: 11 august 2004 Author: John Burkardt
' Reference:
' Paul Bratley, Bennett Fox, L E Schrage,
' A Guide to Simulation,
' floater publisher, pages 201-202, 1983.
'
' Pierre L'Ecuyer,
' Random Number generation,
' in Handbook of Simulation,
' edited by Jerry Banks,
' Wiley Interscience, page 95, 1998.
'
' Bennett Fox,
' Algorithm 647:
' Implementation and Relative Efficiency of Quasirandom
' Sequence Generators,
' ACM Transactions on Mathematical software,
' Volume 12, Number 4, pages 362-376, 1986.
'
' P A Lewis, A s Goodman, J M Miller,
' A pseudo-Random Number Generator for the system/360,
' IBM Systems journal,
' Volume 8, pages 136-143, 1969.
'
' Parameters:
'
' Input/output, integer SEED, the "seed" value, which should NOT be 0.
' On output, SEED has been updated.
'
' output, real R_UNIFORM_01, a new pseudorandom variate,
' strictly between 0 and 1.
' Although SEED can be represented exactly as a 32 bit integer,
' it generally cannot be represented exactly as a 32 bit real number!
|
|
|
| XProfan 11Computer: Gerät, daß es in Mikrosekunden erlaubt, 50.000 Fehler zu machen, zB 'daß' statt 'das'... | 05/22/21 ▲ |
|
|
|
|
Michael W. | there XProfan in Delphi written is:
The Algo building always on the previous Zufallszahl on. it'll means always a follow generiert, The through Randomize new initialized becomes (without Randomize is the first worth 0)
The ermittelte number (RandomSeed) becomes in a Longint stored, means on 2^32 gekappt.
Randomize fetch new values from the ongoing SystemCounter, means "seit when runs the Betriebssystem". too this worth is sometime again with zero arrived and runs unending.
for normal Zufallszahlen reicht the, if on the Program Start once Randomize called becomes. otherwise ought to a Own Random-function gebastelt go.
Perhaps should we from the internet time some brauchbare Formeln collect and shape of RndNum(FormelNr,RandSeed) as Übervater available make. the can then Yes evtl. optimiert go.
go for Verschlüsselungen not anyhow Zufallsfollow needed? |
|
|
| |
|
|