restructure and add ipi texs

This commit is contained in:
2019-11-06 18:24:04 +01:00
parent e21da561fc
commit 8fd8d2a485
155 changed files with 129 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
class Zufall {
public:
Zufall (unsigned int anfang);
unsigned int ziehe_zahl ();
private:
unsigned int x;
} ;
Zufall::Zufall (unsigned int anfang) {
x = anfang;
}
// Implementierung ohne lange Arithmetik
// siehe Numerical Recipes, Kap. 7.
unsigned int Zufall::ziehe_zahl ()
{
// a = 7^5, m = 2^31-1
unsigned int ia = 16807, im = 2147483647;
unsigned int iq = 127773, ir = 2836;
unsigned int k = x/iq;
x = ia*(x-k*iq)-ir*k;
if (x<0) x = x+im;
return x;
}