/*************************************************************************************************************************************/
/* */
/* E T U D E D E L A C O M P L E X I T E S T R U C T U R E L L E */
/* D ' U N E M A R C H E A L E A T O I R E F E R M E E S U R U N T O R E : */
/* */
/* */
/* Author of '$xrC/ObjetComplexe.71$vv$c' : */
/* */
/* Jean-Francois Colonna (LACTAMME, 20130504131513). */
/* */
/*************************************************************************************************************************************/
#ifdef COMMENTS
# undef COMMENTS
#else
#endif
#define COMMENTS "Marche aleatoire sur un tore (format octet) -noir ou blanc-"
#include "images_1octet.01.vv.I"
#include "Flogarithme2.01.vv.I"
long int m;
long int seuil;
long int masque;
long int a=0x5DEECE66D;
long int c=0xB;
long int d=gSOUS(48,32);
long int Xi=1;
int FonctionPrivee_aleatoire(masque)
int masque;
{
Xi = REST(ADD2(MUL2(a,Xi),c),m);
return((int)ETLO(DECD(Xi,d),((long int)masque)));
}
#ifndef ITERATIONS
# define ITERATIONS \
gMUL2(MAX2(dimX,dimY),5)
#else
#endif
#ifndef DIVISEUR_X
# define DIVISEUR_X \
(12)
#else
#endif
#ifndef DIVISEUR_Y
# define DIVISEUR_Y \
(12)
#else
#endif
int iterations=ITERATIONS;
int diviseur_X=DIVISEUR_X;
int diviseur_Y=DIVISEUR_Y;
MAIN(
{
int masqueX=(1 << (int)Flogarithme2(dimX))-1;
int masqueY=(1 << (int)Flogarithme2(dimY))-1;
int nombre;
int xD;
int yD;
int x1;
int y1;
int x2;
int y2;
int signe=+1;
m=MUL2(4096,4096);
m=MUL2(m,m);
seuil=DIVI(m,2);
masque=SOUS(m,1);
/* Les valeurs des parametres {m,seuil,a,c} sont ceux de la fonction 'drand48(...)'. */
INITIALISATION_IMAGE(NOIR);
xD=x1=ADD2(Xmin,DIVI(dimX,2));
yD=y1=ADD2(Ymin,DIVI(dimY,2));
for (nombre=1 ; nombre <= iterations ; nombre=ADD2(nombre,1))
{
x2=COND(IFLT(nombre,iterations),x1+((signe*FonctionPrivee_aleatoire(masqueX))/diviseur_X),xD);
y=y2=y1;
for (x=MIN2(x1,x2) ; x <= MAX2(x1,x2) ; x=ADD2(x,1))
{
STORE_IMAGE_TORE(x,y,BLANC);
}
x1=x2;
y1=y2;
x=x2=x1;
y2=COND(IFLT(nombre,iterations),y1+((signe*FonctionPrivee_aleatoire(masqueY))/diviseur_Y),yD);
for (y=MIN2(y1,y2) ; y <= MAX2(y1,y2) ; y=ADD2(y,1))
{
STORE_IMAGE_TORE(x,y,BLANC);
}
x1=x2;
y1=y2;
signe=NEGA(signe);
}
SORTIE_DU_FICHIER_IMAGE;
EDITER_LES_COMPTEURS_DES_FONCTIONS;
}
)
Copyright © Jean-François Colonna, 2013-2021.
Copyright © CMAP (Centre de Mathématiques APpliquées) UMR CNRS 7641 / Ecole Polytechnique, 2013-2021.