_______________________________________________________________________________________________________________________________________ /*************************************************************************************************************************************/ /* */ /* G E N E R A T E U R S A L E A T O I R E S : */ /* */ /* */ /* Definition : */ /* */ /* Dans ce fichier se trouvent */ /* des generateurs aleatoires bi- */ /* et tri-dimensionnels redonnant */ /* toujours la meme valeur en les */ /* memes points (a graine constante...). */ /* */ /* */ /* Author of '$ximf/aleatoires$FON' : */ /* */ /* Jean-Francois COLONNA (LACTAMME, 19870000000000). */ /* */ /*************************************************************************************************************************************/ /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* C H O I X D E L A F A C O N D E S E R A M E N E R A [ I N F , S U P ] : */ /* */ /*************************************************************************************************************************************/ #nodefine RDN_RETOUR_A_INF_SUP_VERSION_01 \ /* Cette facon de se ramener a [inf,sup] est historique... */ #define RDN_RETOUR_A_INF_SUP_VERSION_02 \ /* Cette facon de se ramener a [inf,sup] est beaucoup plus simple, mais surtout, elle */ \ /* evite des divisions par 0... */ #ifdef RDN_RETOUR_A_INF_SUP_VERSION_01 /* Common,DEFV(Fonction,) : avec 'VERSION_01'. */ DEFV(Common,DEFV(Logical,_____RDN_RETOUR_A_INF_SUP_VERSION_01)); #Aifdef RDN_RETOUR_A_INF_SUP_VERSION_01 /* Common,DEFV(Fonction,) : avec 'VERSION_01'. */ #Eifdef RDN_RETOUR_A_INF_SUP_VERSION_01 /* Common,DEFV(Fonction,) : avec 'VERSION_01'. */ #ifdef RDN_RETOUR_A_INF_SUP_VERSION_02 /* Common,DEFV(Fonction,) : avec 'VERSION_02'. */ DEFV(Common,DEFV(Logical,_____RDN_RETOUR_A_INF_SUP_VERSION_02)); #Aifdef RDN_RETOUR_A_INF_SUP_VERSION_02 /* Common,DEFV(Fonction,) : avec 'VERSION_02'. */ #Eifdef RDN_RETOUR_A_INF_SUP_VERSION_02 /* Common,DEFV(Fonction,) : avec 'VERSION_02'. */ /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* P A R A M E T R E S D E S G E N E R A T E U R S A L E A T O I R E S : */ /* */ /*************************************************************************************************************************************/ /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* P O U R G E N E R E R D E S G R A I N E S */ /* 3 2 B I T S ( rdnI ) E T 2 4 B I T S ( rdnF ) : */ /* */ /*************************************************************************************************************************************/ #define gen24_graine(graine) \ SLRS(graine,ADD2(NBITOC,W)) \ /* Afin qu'il n'y ait pas d'overflow flottant... */ #define gen32_graine(graine) \ NEUT(graine) /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* G E N E R A T I O N D E S D O N N E S N E C E S S A I R E S A U X */ /* D I F F E R E N T S G E N E R A T E U R S A L E A T O I R E S : */ /* */ /*************************************************************************************************************************************/ #define genere_donnees_rdn \ DEFV(Int,INIT(D_graine,A_graine)); \ /* Graine Dynamique reellement utilisee et initialisee a partir de la graine Argument. */ \ DEFV(Int,INIT(fy,UNDEF)); \ /* Fonction de la coordonnee 'y'. */ \ DEFV(Int,INIT(fx,UNDEF)); \ /* Fonction de la coordonnee 'x', */ \ DEFV(Sint,INIT(magik,MAGIK)); \ /* Constante magique de shuffling"... */ \ DEFV(Sfloat,INIT(inf,FLOT__UNDEF)); \ /* Borne inferieure du generateur. */ \ DEFV(Sfloat,INIT(sup,FLOT__UNDEF)); \ /* Borne superieure du generateur, */ \ DEFV(Sfloat,INIT(sup64,FLOT__UNDEF)); \ /* Sup64=(sup/inf64). */ \ /* */ \ /* ATTENTION : cette variable n'est utilisee que dans la 'VERSION_01' mais laissee */ \ /* malgre tout pour ne pas changer le nombre des arguments des fonctions... */ \ DEFV(Sfloat,INIT(unmis,FLOT__UNDEF)); \ /* Unmis=(1-(inf/sup)). */ \ /* */ \ /* ATTENTION : cette variable n'est utilisee que dans la 'VERSION_01' mais laissee */ \ /* malgre tout pour ne pas changer le nombre des arguments des fonctions... */ \ DEFV(Sfloat,INIT(unpis,FLOT__UNDEF)); \ /* Unpis=(inf32*(1+(inf/sup))). */ \ /* */ \ /* ATTENTION : cette variable n'est utilisee que dans la 'VERSION_01' mais laissee */ \ /* malgre tout pour ne pas changer le nombre des arguments des fonctions... */ \ DEFV(Float,INIT(rdn,FLOT__UNDEF)); \ /* Valeur renvoyee par le generateur ; on notera que cette */ \ /* valeur (lorsque 'A_graine' est fixe, est toujours la */ \ /* meme au point (x,y[,z])...). */ #define genere_donnees_rdn_2D \ genere_donnees_rdn; #define genere_donnees_rdn_3D \ DEFV(Int,INIT(fz,UNDEF)); \ /* Fonction de la coordonnee 'z'. */ \ genere_donnees_rdn; /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* P O U R N E P A S M O D I F I E R L E C O D E : */ /* */ /*************************************************************************************************************************************/ #define MoDu(x,origine,extremite) \ SE13(x,origine,extremite) \ /* En effet, dans chaque fonction 'genX_ft(...)' se trouvait jusqu'a present un */ \ /* operateur 'MODU(...,MOINS_L_INFINI,INFINI)' qui n'apporte pas grand chose, puisque */ \ /* bien entendu, il est theoriquement impossible de generer des nombres entiers hors du */ \ /* segment [MOINS_L_INFINI,INFINI] (sauf si 'INFINI' est inferieur a l'infini entier de */ \ /* la machine surlaquelle se fait la compilation) ; d'autre part, de part la definition */ \ /* de 'MODU(x,origine,extremite)', on se trouve contraint d'evaluer la valeur de */ \ /* l'expression 'LENG(MOINS_L_INFINI,INFINI)', ce qui malheureusement n'est pas possible. */ \ /* Ainsi, pour ne pas me fatiguer, j'ai introduit 'MoDu(x,origine,extremite)' qui est */ \ /* neutre vis a vis de son argument 'x'... */ /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* Q U E L Q U E S M E T H O D E S D E G E N E R E R U N E C O M B I N A I S O N */ /* D E S C O O R D O N N E E S ( X , Y [ , Z ] ) P O U R I N I T I A L I S E R */ /* L A G E N E R A T I O N D E S N O M B R E S A L E A T O I R E S : */ /* */ /* */ /* Definitions : */ /* Plusieurs generateurs sont disponibles : */ /* 'gen1_ft', 'gen2_ft',... qui sont refe- */ /* rences la ou il le faut via 'gen_ft' ; */ /* 'gen4_ft' semble le meilleur generateur, */ /* mais malheureusement, il est lent ; */ /* 'gen5_ft' est bon, et un parametre */ /* 'random_gen5' en controle la qualite... */ /* */ /*************************************************************************************************************************************/ #define Coordonnee_non_nulle(coordonnee) \ COND(IZNE(coordonnee),coordonnee,D_graine) \ /* Cette procedure a ete introduite afin d'eviter le probleme de l'injection de coordonnees */ \ /* nulles. En effet, ils donnent alors, quelle que soit la graine, la meme valeur, ce qui */ \ /* est plus qu'ennuyeux ! On notera qu'on remplace arbitrairement la coordonnee argument par */ \ /* la valeur 'D_graine' ou "graine" ; en effet, il est inconcevable d'utiliser d'autres */ \ /* solutions (du type 'SUC?(coordonnee)'), puisqu'alors le risque serait de generer deux */ \ /* aleatoires identiques, par exemple a la suite l'un de l'autre... */ \ /* */ \ /* Cette operation a ete effectuee le 1995022300 ; elle risque d'avoir des consequences */ \ /* importantes, car, en effet, les programmes qui ont ete ainsi modifies ne donneront plus */ \ /* les memes suites de nombres aleatoires... */ #define gen1_ft(ft,t,Cast,graineA,graineB) \ Bblock \ EGAL(ft \ ,OUEX(INTE(MoDu(MUL2(MUL2(Coordonnee_non_nulle(Cast(ASI1(pointA,t))) \ ,Cast(COND(IZNE(D_graine),D_graine,graineB)) \ ) \ ,Cast(graineA) \ ) \ ,MOINS_L_INFINI \ ,INFINI \ ) \ ) \ ,graineB \ ) \ ); \ EGAL(ft \ ,OUEX(SARS(ft,NBITHW) \ ,ETLO(ft,MHWD) \ ) \ ); \ Eblock #define gen2_ft(ft,t,Cast,graineA,graineB) \ Bblock \ EGAL(ft \ ,OUEX(INTE(MoDu(MUL2(MUL2(Coordonnee_non_nulle(Cast(ASI1(pointA,t))) \ ,Cast(graineA) \ ) \ ,Cast(COND(IZNE(D_graine),D_graine,graineB)) \ ) \ ,MOINS_L_INFINI \ ,INFINI \ ) \ ) \ ,graineB \ ) \ ); \ EGAL(ft \ ,OUEX(SARS(ft,NBITHW) \ ,ETLO(ft,MHWD) \ ) \ ); \ Eblock #define random_17 SUCC(SEIZE) \ /* Parametre bizarre : on est oblige d'appeler "random" 17 fois */ \ /* apres son initialisation avant de retrouver le meme nombre aleatoire */ \ /* avec les memes parametres d'appel (bien entendu...). */ DEFV(Extern,DEFV(Void,srand())); DEFV(Extern,DEFV(vrai_Int_de_base,rand())); /* Introduit le 20120626164251 (avec quelques annees de retard, mais cela s'est vu lors de */ /* l'introduction de 'v $xcc/LFonctions$vv$D/definitions$vv$Y FiLeT_CaTaLoGuE_FS'...). */ #define gen3_ft(ft,t,Cast,graineA,graineB) \ Bblock \ srand(OUEX(INTE(MoDu(MUL2(MUL2(Coordonnee_non_nulle(Cast(ASI1(pointA,t))) \ ,Cast(graineA) \ ) \ ,Cast(COND(IZNE(D_graine),D_graine,graineB)) \ ) \ ,MOINS_L_INFINI \ ,INFINI \ ) \ ) \ ,graineB \ ) \ ); \ EGAL(ft,rand()); \ Eblock #define gen4_ft(ft,t,Cast,graineA,graineB) \ Bblock \ srandom(OUEX(INTE(MoDu(MUL2(MUL2(Coordonnee_non_nulle(Cast(ASI1(pointA,t))) \ ,Cast(graineA) \ ) \ ,Cast(COND(IZNE(D_graine),D_graine,graineB)) \ ) \ ,MOINS_L_INFINI \ ,INFINI \ ) \ ) \ ,graineB \ ) \ ); \ \ begin_nouveau_block \ Bblock \ Repe(random_17) \ Bblock \ CALS(random()); \ /* On fait cela afin de retomber toujours sur le meme nombre aleatoire... */ \ Eblock \ ERep \ Eblock \ end_nouveau_block \ \ EGAL(ft,ETLO(INTE(random()),MMOT)); \ Eblock \ /* Et enfin generation de la valeur aleatoire... */ #define random_gen5 \ TROIS \ /* Parametre de controle de la qualite du generateur 'gen5_ft' dans [ZERO,NBITMO]. */ #define gen5_ft(ft,t,Cast,graineA,graineB) \ Bblock \ DEFV(Int,INIT(fpoint,UNDEF)); \ \ EGAL(fpoint \ ,OUEX(INTE(MoDu(MUL2(MUL2(Coordonnee_non_nulle(Cast(ASI1(pointA,t))) \ ,Cast(graineA) \ ) \ ,Cast(COND(IZNE(D_graine),D_graine,graineB)) \ ) \ ,MOINS_L_INFINI \ ,INFINI \ ) \ ) \ ,graineB \ ) \ ); \ \ Repe(random_gen5) \ Bblock \ INCR(fpoint,SALS(fpoint,BIT)); \ Eblock \ ERep \ \ EGAL(ft,ETLO(MUL2(fpoint,magik),MMOT)); \ /* Et enfin generation de la valeur aleatoire... */ \ Eblock #if ( (! defined(SYSTEME_APC_LinuxDebian_GCC)) \ && (! defined(SYSTEME_APC_LinuxMandrake_GCC)) \ && (! defined(SYSTEME_APC_LinuxRedHat_GCC)) \ && (! defined(SYSTEME_APC_LinuxUbuntu_GCC)) \ && (! defined(SYSTEME_APC_LinuxUbuntu_ICC)) \ && (! defined(SYSTEME_APC_LinuxUlmint_GCC)) \ && (! defined(SYSTEME_APC_LinuxUlmint_ICC)) \ && (! defined(SYSTEME_DECALPHA340_OSF1_CC)) \ && (! defined(SYSTEME_DECALPHA350_OSF1_CC)) \ && (! defined(SYSTEME_DECALPHA464_OSF1_CC)) \ && (! defined(SYSTEME_FX2800_CONCENTRIX_SCC)) \ && (! defined(SYSTEME_SGIND308_IRIX_CC)) \ && (! defined(SYSTEME_SGIND324_IRIX_CC)) \ && (! defined(SYSTEME_SGIND3GA_IRIX_CC)) \ && (! defined(SYSTEME_SGIND408_IRIX_CC)) \ && (! defined(SYSTEME_SGIND424_IRIX_CC)) \ && (! defined(SYSTEME_SGIND4GA_IRIX_CC)) \ && (! defined(SYSTEME_SGIND508_IRIX_CC)) \ && (! defined(SYSTEME_SGIND524_IRIX_CC)) \ && (! defined(SYSTEME_SGIND5GA_IRIX_CC)) \ && (! defined(SYSTEME_SGIND808_IRIX_CC)) \ && (! defined(SYSTEME_SGIND824_IRIX_CC)) \ && (! defined(SYSTEME_SGIND8GA_IRIX_CC)) \ && (! defined(SYSTEME_SGINDA08_IRIX_CC)) \ && (! defined(SYSTEME_SGINDA24_IRIX_CC)) \ && (! defined(SYSTEME_SGINDAGA_IRIX_CC)) \ && (! defined(SYSTEME_SGO200A1_IRIX_CC)) \ && (! defined(SYSTEME_SGO200A2_IRIX_CC)) \ && (! defined(SYSTEME_SGO200A4_IRIX_CC)) \ && (! defined(SYSTEME_SGO25224_IRIX_CC)) \ && (! defined(SYSTEME_SGO252VA_IRIX_CC)) \ && (! defined(SYSTEME_SGO252VN_IRIX_CC)) \ && (! defined(SYSTEME_SGPCM801_IRIX_CC)) \ && (! defined(SYSTEME_SGPCMA01_IRIX_CC)) \ ) # define MULTIPLIEUR_GEN6 \ MUL2(MAGIK,EXP4(MAGIK)) \ /* Definition du multiplieur 'a'. */ # define MODULO_GEN6 \ DEUXp31M1 \ /* Definition du modulo 'm'. */ # define gen6_ft(ft,t,Cast,graineA,dummy) \ /* Cette methode due a Lehmer est basee sur l'iteration suivante : */ \ /* */ \ /* z = f(z ), */ \ /* n+1 n */ \ /* */ \ /* avec : */ \ /* */ \ /* f(z) = [a.z] modulo m, */ \ /* */ \ /* et : */ \ /* */ \ /* z E [1,m-1], */ \ /* a E [2,m-1], dit le multiplieur (16807 = 7 est une bonne valeur), */ \ /* m un grand nombre premier, par exemple : */ \ /* */ \ /* 31 */ \ /* m = 2 - 1 = 2147483647. */ \ /* */ \ /*********************************************************************************************/ \ Bblock \ DEFV(Int,INIT(valeur_de_manoeuvre \ ,SOUS(MUL2(MULTIPLIEUR_GEN6 \ ,REST(MUL2(OUEX(graineA,D_graine),Coordonnee_non_nulle(Cast(ASI1(pointA,t)))) \ ,QUOD(MODULO_GEN6,MULTIPLIEUR_GEN6) \ ) \ ) \ ,MUL2(REST(MODULO_GEN6,MULTIPLIEUR_GEN6) \ ,QUOD(MUL2(OUEX(graineA,D_graine),Coordonnee_non_nulle(Cast(ASI1(pointA,t)))) \ ,QUOD(MODULO_GEN6,MULTIPLIEUR_GEN6) \ ) \ ) \ ) \ ) \ ); \ /* Definition de : */ \ /* t */ \ /* valeur_de_manoeuvre = a . [t] - [m] . ----- */ \ /* m modulo a m */ \ /* modulo --- --- */ \ /* a a */ \ /* */ \ /* ou 't' designe la coordonnee courante combinee a 'D_graine' et 'graineA'. */ \ EGAL(ft \ ,COND(IZGT(valeur_de_manoeuvre) \ ,valeur_de_manoeuvre \ ,ADD2(valeur_de_manoeuvre,MODULO_GEN6) \ ) \ ); \ Eblock #Aif ( (! defined(SYSTEME_APC_LinuxDebian_GCC)) \ && (! defined(SYSTEME_APC_LinuxMandrake_GCC)) \ && (! defined(SYSTEME_APC_LinuxRedHat_GCC)) \ && (! defined(SYSTEME_APC_LinuxUbuntu_GCC)) \ && (! defined(SYSTEME_APC_LinuxUbuntu_ICC)) \ && (! defined(SYSTEME_APC_LinuxUlmint_GCC)) \ && (! defined(SYSTEME_APC_LinuxUlmint_ICC)) \ && (! defined(SYSTEME_DECALPHA340_OSF1_CC)) \ && (! defined(SYSTEME_DECALPHA350_OSF1_CC)) \ && (! defined(SYSTEME_DECALPHA464_OSF1_CC)) \ && (! defined(SYSTEME_FX2800_CONCENTRIX_SCC)) \ && (! defined(SYSTEME_SGIND308_IRIX_CC)) \ && (! defined(SYSTEME_SGIND324_IRIX_CC)) \ && (! defined(SYSTEME_SGIND3GA_IRIX_CC)) \ && (! defined(SYSTEME_SGIND408_IRIX_CC)) \ && (! defined(SYSTEME_SGIND424_IRIX_CC)) \ && (! defined(SYSTEME_SGIND4GA_IRIX_CC)) \ && (! defined(SYSTEME_SGIND508_IRIX_CC)) \ && (! defined(SYSTEME_SGIND524_IRIX_CC)) \ && (! defined(SYSTEME_SGIND5GA_IRIX_CC)) \ && (! defined(SYSTEME_SGIND808_IRIX_CC)) \ && (! defined(SYSTEME_SGIND824_IRIX_CC)) \ && (! defined(SYSTEME_SGIND8GA_IRIX_CC)) \ && (! defined(SYSTEME_SGINDA08_IRIX_CC)) \ && (! defined(SYSTEME_SGINDA24_IRIX_CC)) \ && (! defined(SYSTEME_SGINDAGA_IRIX_CC)) \ && (! defined(SYSTEME_SGO200A1_IRIX_CC)) \ && (! defined(SYSTEME_SGO200A2_IRIX_CC)) \ && (! defined(SYSTEME_SGO200A4_IRIX_CC)) \ && (! defined(SYSTEME_SGO25224_IRIX_CC)) \ && (! defined(SYSTEME_SGO252VA_IRIX_CC)) \ && (! defined(SYSTEME_SGO252VN_IRIX_CC)) \ && (! defined(SYSTEME_SGPCM801_IRIX_CC)) \ && (! defined(SYSTEME_SGPCMA01_IRIX_CC)) \ ) # define gen6_ft(ft,t,Cast,graineA,graineB) \ /* Cette methode est malheureusement inutilisable sur ces SYSTEMEs car, en effet, elle */ \ /* conduit a des debordements arithmetiques lors de la compilation de la valeur initiale */ \ /* de la variable 'valeur_de_manoeuvre' dans les operations 'SOUS(...)' et 'MUL2(...)'. */ \ /* On obtient alors les messages suivants : */ \ /* */ \ /* 1-SYSTEME_DECALPHA3?0_OSF1_CC : */ \ /* */ \ /* /usr/lib/cmplrs/cc/cfe: Warning:...value is outside range representable */ \ /* for type 'int' */ \ /* */ \ /* 2-SYSTEME_SGIND???_IRIX_CC : */ \ /* */ \ /* accom: Warning 238:... Operation * on signed integral constant overflows */ \ /* */ \ /* 3-SYSTEME_FX2800_CONCENTRIX_SCC : */ \ /* */ \ /* scc - warning: (1) Expression constant out of range, adjusting */ \ /* */ \ /* 4-SYSTEME_APC_LinuxDebian_GCC : */ \ /* 5-SYSTEME_APC_LinuxMandrake_GCC : */ \ /* 6-SYSTEME_APC_LinuxRedHat_GCC : */ \ /* 7-SYSTEME_APC_LinuxUbuntu_GCC : */ \ /* 8-SYSTEME_APC_LinuxUbuntu_ICC : */ \ /* 9-SYSTEME_APC_LinuxUlmint_GCC : */ \ /* A-SYSTEME_APC_LinuxUlmint_ICC : */ \ /* */ \ /* warning: integer overflow in expression */ \ /* */ \ Bblock \ gen5_ft(ft,t,Cast,graineA,graineB); \ /* On remplace donc alors 'gen6_ft(...)' par la methode standard 'gen5_ft(...)'. */ \ Eblock #Eif ( (! defined(SYSTEME_APC_LinuxDebian_GCC)) \ && (! defined(SYSTEME_APC_LinuxMandrake_GCC)) \ && (! defined(SYSTEME_APC_LinuxRedHat_GCC)) \ && (! defined(SYSTEME_APC_LinuxUbuntu_GCC)) \ && (! defined(SYSTEME_APC_LinuxUbuntu_ICC)) \ && (! defined(SYSTEME_APC_LinuxUlmint_GCC)) \ && (! defined(SYSTEME_APC_LinuxUlmint_ICC)) \ && (! defined(SYSTEME_DECALPHA340_OSF1_CC)) \ && (! defined(SYSTEME_DECALPHA350_OSF1_CC)) \ && (! defined(SYSTEME_DECALPHA464_OSF1_CC)) \ && (! defined(SYSTEME_FX2800_CONCENTRIX_SCC)) \ && (! defined(SYSTEME_SGIND308_IRIX_CC)) \ && (! defined(SYSTEME_SGIND324_IRIX_CC)) \ && (! defined(SYSTEME_SGIND3GA_IRIX_CC)) \ && (! defined(SYSTEME_SGIND408_IRIX_CC)) \ && (! defined(SYSTEME_SGIND424_IRIX_CC)) \ && (! defined(SYSTEME_SGIND4GA_IRIX_CC)) \ && (! defined(SYSTEME_SGIND508_IRIX_CC)) \ && (! defined(SYSTEME_SGIND524_IRIX_CC)) \ && (! defined(SYSTEME_SGIND5GA_IRIX_CC)) \ && (! defined(SYSTEME_SGIND808_IRIX_CC)) \ && (! defined(SYSTEME_SGIND824_IRIX_CC)) \ && (! defined(SYSTEME_SGIND8GA_IRIX_CC)) \ && (! defined(SYSTEME_SGINDA08_IRIX_CC)) \ && (! defined(SYSTEME_SGINDA24_IRIX_CC)) \ && (! defined(SYSTEME_SGINDAGA_IRIX_CC)) \ && (! defined(SYSTEME_SGO200A1_IRIX_CC)) \ && (! defined(SYSTEME_SGO200A2_IRIX_CC)) \ && (! defined(SYSTEME_SGO200A4_IRIX_CC)) \ && (! defined(SYSTEME_SGO25224_IRIX_CC)) \ && (! defined(SYSTEME_SGO252VA_IRIX_CC)) \ && (! defined(SYSTEME_SGO252VN_IRIX_CC)) \ && (! defined(SYSTEME_SGPCM801_IRIX_CC)) \ && (! defined(SYSTEME_SGPCMA01_IRIX_CC)) \ ) #define random_gen7_iterations \ DIX \ /* Premier parametre de controle du generateur 'gen7_ft' (nombre d'iterations). */ #define random_gen7_graineA \ SUCC(SEIZE) \ /* Second parametre de controle du generateur 'gen7_ft' (premiere graine de generation). */ #define random_gen7_graineB \ SUCC(SEIZE) \ /* Troisieme parametre de controle du generateur 'gen7_ft' (seconde graine de generation). */ #define gen7_ft(ft,t,Cast,graineA,dummy) \ /* Cette methode est basee sur l'iteration suivante : */ \ /* */ \ /* z = f(z ), */ \ /* n+1 n */ \ /* */ \ /* avec : */ \ /* */ \ /* 2 */ \ /* f(z) = gA . (gB + z ) */ \ /* */ \ /* et : */ \ /* */ \ /* z = (pointA.t) . D_graine */ \ /* 0 */ \ Bblock \ EGAL(ft \ ,INTE(MoDu(MUL2(Coordonnee_non_nulle(Cast(ASI1(pointA,t))) \ ,Cast(COND(IZNE(D_graine),D_graine,graineA)) \ ) \ ,MOINS_L_INFINI \ ,INFINI \ ) \ ) \ ); \ \ Repe(random_gen7_iterations) \ Bblock \ EGAL(ft \ ,MUL2(random_gen7_graineA \ ,ADD2(random_gen7_graineB \ ,EXP2(ft) \ ) \ ) \ ); \ Eblock \ ERep \ Eblock /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* M E T H O D E C H O I S I E P O U R G E N E R E R U N E C O M B I N A I S O N */ /* D E S C O O R D O N N E E S ( X , Y [ , Z ] ) P O U R I N I T I A L I S E R */ /* L A G E N E R A T I O N D E S N O M B R E S A L E A T O I R E S : */ /* */ /*************************************************************************************************************************************/ DEFV(Common,DEFV(Int,ZINT(gen_ft_____methode_standard,METHODE_STANDARD_gen_ft))); /* Choix de la methode de generation aleatoire a utiliser (la version implicite est */ /* la methode standard est 'gen5_ft'). */ #define genX_ft(nom_de_la_methodeX,numero_de_la_methodeX,ft,t,Cast,graineA,graineB) \ Ca1e(numero_de_la_methodeX) \ Bblock \ nom_de_la_methodeX(ft,t,Cast,graineA,graineB); \ Eblock \ ECa1 \ /* Cette macro permet de referencer la fonction de generation aleatoire courante... */ #define gen_ft(ft,t,Cast,graineA,graineB) \ Bblock \ Choi(gen_ft_____methode_standard) \ Bblock \ genX_ft(gen1_ft,GENERATEUR_ALEATOIRE_gen1,ft,t,Cast,graineA,graineB) \ genX_ft(gen2_ft,GENERATEUR_ALEATOIRE_gen2,ft,t,Cast,graineA,graineB) \ genX_ft(gen3_ft,GENERATEUR_ALEATOIRE_gen3,ft,t,Cast,graineA,graineB) \ genX_ft(gen5_ft,GENERATEUR_ALEATOIRE_gen5,ft,t,Cast,graineA,graineB) \ genX_ft(gen6_ft,GENERATEUR_ALEATOIRE_gen6,ft,t,Cast,graineA,graineB) \ genX_ft(gen7_ft,GENERATEUR_ALEATOIRE_gen7,ft,t,Cast,graineA,graineB) \ Defo \ Bblock \ PRINT_ERREUR("le code du generateur aleatoire demande n'existe pas"); \ gen5_ft(ft,t,Cast,graineA,graineB); \ /* Generateur implicite en cas d'erreur... */ \ Eblock \ EDef \ Eblock \ ECho \ Eblock \ /* Cette macro permet d'acceder au generateur aleatoire courant. */ /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* M E T H O D E S D ' I T E R A T I O N E T D ' A F F I N A G E : */ /* */ /*************************************************************************************************************************************/ #define iterer_la_generation_de_rdnI2D \ rdnIFnD_____iterer_la_generation #define iterer_la_generation_de_rdnF2D \ rdnIFnD_____iterer_la_generation #define iterer_la_generation_de_rdnI3D \ rdnIFnD_____iterer_la_generation #define iterer_la_generation_de_rdnF3D \ rdnIFnD_____iterer_la_generation DEFV(Common,DEFV(Logical,ZINT(rdnIFnD_____iterer_la_generation,FAUX))); /* Faut-il iterer les fonctions du type 'rdnIFnD(...)' ({rdnI2D,rdnF2D,rdnI3D,rdnF3D}) ? */ DEFV(Common,DEFV(Logical,ZINT(rdnIFnD_____affiner_la_generation,FAUX))); /* Faut-il affiner le generateur de base en l'utilisant comme graine vers un generateur */ /* standard ? */ /* Le 20230809102028 'RDN_STANDARD' et 'INITIALISATION_RDN_STANDARD(...)' ont ete deplace */ /* dans 'v $xil/defi_c1$vv$DEF RDN_STANDARD' pour 'v $xrk/dominos.01$K RDN_STANDARD'... */ /* Il en fut de meme des deux 'Extern's relatifs a 'drand48()' et 'srand48(...)'... */ #define AFFINAGE_DES_VALEURS_ALEATOIRES(graine) \ Bblock \ DEFV(vrai_Long_Int_de_base,INIT(graine_du_generateur_standard,graine)); \ DEFV(vrai_Double_de_base,INIT(rdn_standard,FLOT__UNDEF)); \ \ INITIALISATION_RDN_STANDARD(graine_du_generateur_standard); \ \ EGAL(rdn_standard,RDN_STANDARD); \ /* ATTENTION : le passage par 'rdn_standard' intermediaire est destine a eviter de calculer */ \ /* plusieurs fois 'RDN_STANDARD' dans le 'DENO(...)' qui suit... */ \ EGAL(rdn,DENO(rdn_standard,inf,sup)); \ Eblock \ /* Affinage des valeurs aleatoires en utilisant 'rdn_entier' comme graine d'un generateur */ \ /* standard. */ /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* C A L C U L D E L A V A L E U R A L E A T O I R E D A N S [ I N F , S U P ] 2 D / 3 D : */ /* */ /*************************************************************************************************************************************/ #ifdef RDN_RETOUR_A_INF_SUP_VERSION_01 # define calcul_rdn_ND(fonctions) \ Bblock \ DEFV(Int,INIT(rdn_entier,fonctions)); \ /* Valeur aleatoire 'Int' a convertir en 'Float' et a mettre dans le segment [inf,sup] */ \ /* (introduit le 20010110110405). */ \ \ Test(IL_NE_FAUT_PAS(rdnIFnD_____affiner_la_generation)) \ Bblock \ EGAL(rdn \ ,MUL2(sup64 \ ,ADD2(unpis \ ,MUL2(unmis \ ,FLOT(MUL2(MUL2(rdn_entier \ ,COND(IZNE(D_graine),D_graine,magik) \ ) \ ,magik \ ) \ ) \ ) \ ) \ ) \ ); \ Eblock \ ATes \ Bblock \ AFFINAGE_DES_VALEURS_ALEATOIRES(rdn_entier); \ Eblock \ ETes \ Eblock \ /* Afin de se ramener au segment [inf,sup]. */ #Aifdef RDN_RETOUR_A_INF_SUP_VERSION_01 #Eifdef RDN_RETOUR_A_INF_SUP_VERSION_01 #ifdef RDN_RETOUR_A_INF_SUP_VERSION_02 # define calcul_rdn_ND(fonctions) \ Bblock \ DEFV(Int,INIT(rdn_entier,fonctions)); \ /* Valeur aleatoire 'Int' a convertir en 'Float' et a mettre dans le segment [inf,sup] */ \ /* (introduit le 20010110110405). */ \ \ Test(IL_NE_FAUT_PAS(rdnIFnD_____affiner_la_generation)) \ Bblock \ EGAL(rdn \ ,MOIT(ADD2(MUL2(DIVI(FLOT(rdn_entier),FLOT(INFINI)) \ ,SOUS(sup,inf) \ ) \ ,ADD2(inf,sup) \ ) \ ) \ ); \ Eblock \ ATes \ Bblock \ AFFINAGE_DES_VALEURS_ALEATOIRES(rdn_entier); \ Eblock \ ETes \ Eblock \ /* Afin de se ramener au segment [inf,sup] ; pour ce faire appelons 'x' le quotient */ \ /* de 'fonctions' par 'INFINI'. On a alors : */ \ /* */ \ /* rdn - inf sup - inf */ \ /* ---------- = ----------- */ \ /* x - (-1) 1 - (-1) */ \ /* */ \ /* puisque l'on passe de [-1,+1] (l'intervalle de 'x') a [inf,sup]. */ #Aifdef RDN_RETOUR_A_INF_SUP_VERSION_02 #Eifdef RDN_RETOUR_A_INF_SUP_VERSION_02 #nodefine COMBINAISON_DE_2_VALEURS_ALEATOIRES_VERSION_01(rdn_1,rdn_2) \ gMINMAX(rdn_1,rdn_2,inf,sup) \ /* Combinaison de deux valeurs aleatoires de distribution uniforme donnant la distribution */ \ /* suivante : */ \ /* */ \ /* * */ \ /* + + */ \ /* + + */ \ /* + + */ \ /* |--------------|--------------| */ \ /* inf moyenne sup */ \ /* */ \ /* */ \ /* Le 20030222103918, 'COMBINAISON_DE_2_VALEURS_ALEATOIRES_VERSION_01(...)' */ \ /* est passe de 'define' a 'nodefine' afin de ne pas etre recupere par le processus */ \ /* 'v $xcc/cpp$Z _VERSION_'. */ #nodefine COMBINAISON_DE_2_VALEURS_ALEATOIRES_VERSION_02(rdn_1,rdn_2) \ ADD2(MOYE(inf,sup),MOYS(rdn_1,rdn_2)) \ /* Combinaison de deux valeurs aleatoires de distribution uniforme donnant la distribution */ \ /* suivante : */ \ /* */ \ /* * */ \ /* + + */ \ /* + + */ \ /* + + */ \ /* |--------------|--------------| */ \ /* inf moyenne sup */ \ /* */ \ /* */ \ /* Le 20030222103918, 'COMBINAISON_DE_2_VALEURS_ALEATOIRES_VERSION_02(...)' */ \ /* est passe de 'define' a 'nodefine' afin de ne pas etre recupere par le processus */ \ /* 'v $xcc/cpp$Z _VERSION_'. */ #nodefine COMBINAISON_DE_2_VALEURS_ALEATOIRES_VERSION_03(rdn_1,rdn_2) \ ADD2(DIVI(gRho_2D(inf,inf,rdn_1,rdn_2),Rho_2D(FU,FU)),inf) \ /* Combinaison de deux valeurs aleatoires de distribution uniforme donnant la distribution */ \ /* suivante : */ \ /* */ \ /* * */ \ /* + */ \ /* + + */ \ /* + + */ \ /* + + */ \ /* |--------------|--------------| */ \ /* inf moyenne sup */ \ /* */ \ /* */ \ /* Le 20030222103918, 'COMBINAISON_DE_2_VALEURS_ALEATOIRES_VERSION_03(...)' */ \ /* est passe de 'define' a 'nodefine' afin de ne pas etre recupere par le processus */ \ /* 'v $xcc/cpp$Z _VERSION_'. */ #nodefine COMBINAISON_DE_2_VALEURS_ALEATOIRES_VERSION_04(rdn_1,rdn_2) \ MOYE(rdn_1,rdn_2) \ /* Combinaison de deux valeurs aleatoires de distribution uniforme donnant la distribution */ \ /* suivante : */ \ /* */ \ /* * */ \ /* + + */ \ /* + + */ \ /* + + */ \ /* |--------------|--------------| */ \ /* inf moyenne sup */ \ /* */ \ /* */ \ /* Le 20030222103918, 'COMBINAISON_DE_2_VALEURS_ALEATOIRES_VERSION_04(...)' */ \ /* est passe de 'define' a 'nodefine' afin de ne pas etre recupere par le processus */ \ /* 'v $xcc/cpp$Z _VERSION_'. */ #nodefine COMBINAISON_DE_2_VALEURS_ALEATOIRES_VERSION_05(rdn_1,rdn_2) \ ADD2(MOYG(SOUS(rdn_1,inf),SOUS(rdn_2,inf)),inf) \ /* Combinaison de deux valeurs aleatoires de distribution uniforme donnant la distribution */ \ /* suivante : */ \ /* */ \ /* * */ \ /* + + */ \ /* + + */ \ /* + */ \ /* + + */ \ /* |--------------|--------------| */ \ /* inf moyenne sup */ \ /* */ \ /* */ \ /* Le 20030222103918, 'COMBINAISON_DE_2_VALEURS_ALEATOIRES_VERSION_05(...)' */ \ /* est passe de 'define' a 'nodefine' afin de ne pas etre recupere par le processus */ \ /* 'v $xcc/cpp$Z _VERSION_'. */ #nodefine COMBINAISON_DE_2_VALEURS_ALEATOIRES_VERSION_06(rdn_1,rdn_2) \ ADD2(MOYQ(SOUS(rdn_1,inf),SOUS(rdn_2,inf)),inf) \ /* Combinaison de deux valeurs aleatoires de distribution uniforme donnant la distribution */ \ /* suivante : */ \ /* */ \ /* * */ \ /* + */ \ /* + + */ \ /* + + */ \ /* + + */ \ /* |--------------|--------------| */ \ /* inf moyenne sup */ \ /* */ \ /* */ \ /* Le 20030222103918, 'COMBINAISON_DE_2_VALEURS_ALEATOIRES_VERSION_06(...)' */ \ /* est passe de 'define' a 'nodefine' afin de ne pas etre recupere par le processus */ \ /* 'v $xcc/cpp$Z _VERSION_'. */ #define COMBINAISON_DE_2_VALEURS_ALEATOIRES_VERSION_07(rdn_1,rdn_2) \ MODF(MUL2(ADD2(fINTE(GRO4(DIVI(SOUS(rdn_1,inf),SOUS(sup,inf)))),FU),rdn_2),inf,sup) \ /* Combinaison de deux valeurs aleatoires de distribution uniforme donnant la distribution */ \ /* suivante : */ \ /* */ \ /* * * * * * * * * * * * * * * * */ \ /* */ \ /* + + */ \ /* |--------------|--------------| */ \ /* inf moyenne sup */ \ /* */ #define COMBINAISON_DE_2_VALEURS_ALEATOIRES(rdn_1,rdn_2) \ COMBINAISON_DE_2_VALEURS_ALEATOIRES_VERSION_07(rdn_1,rdn_2) \ /* Combinaison de deux valeurs aleatoires (version courante) supposees etre toutes deux */ \ /* de distribution uniforme. A la date du 20010107183006, aucune methode ne redonne une */ \ /* distribution uniforme. A la date du 20010108171314, la methode 'VERSION_07' semble */ \ /* convenir. */ #ifdef COMBINAISON_DE_2_VALEURS_ALEATOIRES_VERSION_01 /* Common,DEFV(Fonction,) : avec 'VERSION_01'. */ DEFV(Common,DEFV(Logical,_____COMBINAISON_DE_2_VALEURS_ALEATOIRES_VERSION_01)); #Aifdef COMBINAISON_DE_2_VALEURS_ALEATOIRES_VERSION_01 /* Common,DEFV(Fonction,) : avec 'VERSION_01'. */ #Eifdef COMBINAISON_DE_2_VALEURS_ALEATOIRES_VERSION_01 /* Common,DEFV(Fonction,) : avec 'VERSION_01'. */ #ifdef COMBINAISON_DE_2_VALEURS_ALEATOIRES_VERSION_02 /* Common,DEFV(Fonction,) : avec 'VERSION_02'. */ DEFV(Common,DEFV(Logical,_____COMBINAISON_DE_2_VALEURS_ALEATOIRES_VERSION_02)); #Aifdef COMBINAISON_DE_2_VALEURS_ALEATOIRES_VERSION_02 /* Common,DEFV(Fonction,) : avec 'VERSION_02'. */ #Eifdef COMBINAISON_DE_2_VALEURS_ALEATOIRES_VERSION_02 /* Common,DEFV(Fonction,) : avec 'VERSION_02'. */ #ifdef COMBINAISON_DE_2_VALEURS_ALEATOIRES_VERSION_03 /* Common,DEFV(Fonction,) : avec 'VERSION_03'. */ DEFV(Common,DEFV(Logical,_____COMBINAISON_DE_2_VALEURS_ALEATOIRES_VERSION_03)); #Aifdef COMBINAISON_DE_2_VALEURS_ALEATOIRES_VERSION_03 /* Common,DEFV(Fonction,) : avec 'VERSION_03'. */ #Eifdef COMBINAISON_DE_2_VALEURS_ALEATOIRES_VERSION_03 /* Common,DEFV(Fonction,) : avec 'VERSION_03'. */ #ifdef COMBINAISON_DE_2_VALEURS_ALEATOIRES_VERSION_04 /* Common,DEFV(Fonction,) : avec 'VERSION_04'. */ DEFV(Common,DEFV(Logical,_____COMBINAISON_DE_2_VALEURS_ALEATOIRES_VERSION_04)); #Aifdef COMBINAISON_DE_2_VALEURS_ALEATOIRES_VERSION_04 /* Common,DEFV(Fonction,) : avec 'VERSION_04'. */ #Eifdef COMBINAISON_DE_2_VALEURS_ALEATOIRES_VERSION_04 /* Common,DEFV(Fonction,) : avec 'VERSION_04'. */ #ifdef COMBINAISON_DE_2_VALEURS_ALEATOIRES_VERSION_05 /* Common,DEFV(Fonction,) : avec 'VERSION_05'. */ DEFV(Common,DEFV(Logical,_____COMBINAISON_DE_2_VALEURS_ALEATOIRES_VERSION_05)); #Aifdef COMBINAISON_DE_2_VALEURS_ALEATOIRES_VERSION_05 /* Common,DEFV(Fonction,) : avec 'VERSION_05'. */ #Eifdef COMBINAISON_DE_2_VALEURS_ALEATOIRES_VERSION_05 /* Common,DEFV(Fonction,) : avec 'VERSION_05'. */ #ifdef COMBINAISON_DE_2_VALEURS_ALEATOIRES_VERSION_06 /* Common,DEFV(Fonction,) : avec 'VERSION_06'. */ DEFV(Common,DEFV(Logical,_____COMBINAISON_DE_2_VALEURS_ALEATOIRES_VERSION_06)); #Aifdef COMBINAISON_DE_2_VALEURS_ALEATOIRES_VERSION_06 /* Common,DEFV(Fonction,) : avec 'VERSION_06'. */ #Eifdef COMBINAISON_DE_2_VALEURS_ALEATOIRES_VERSION_06 /* Common,DEFV(Fonction,) : avec 'VERSION_06'. */ #ifdef COMBINAISON_DE_2_VALEURS_ALEATOIRES_VERSION_07 /* Common,DEFV(Fonction,) : avec 'VERSION_07'. */ DEFV(Common,DEFV(Logical,_____COMBINAISON_DE_2_VALEURS_ALEATOIRES_VERSION_07)); #Aifdef COMBINAISON_DE_2_VALEURS_ALEATOIRES_VERSION_07 /* Common,DEFV(Fonction,) : avec 'VERSION_07'. */ #Eifdef COMBINAISON_DE_2_VALEURS_ALEATOIRES_VERSION_07 /* Common,DEFV(Fonction,) : avec 'VERSION_07'. */ DEFV(Common,DEFV(Int,ZINT(ADAPTATION_A_UNE_LOI_DE_DISTRIBUTION_QUELCONQUE_____loi_de_distribution,RDN_UNIFORME))); /* Le choix de la loi de distribution a ete introduit ainsi le 20110328114903 : */ /* */ /* loi=1 : Loi uniforme, */ /* loi=2 : Loi gaussienne, */ /* loi=3 : Loi arbitraire definie par la substitution courante. */ /* */ /* C'est la loi uniforme qui est choisie par defaut afin d'assurer la compatibilite */ /* anterieure... */ DEFV(Common,DEFV(Int,ZINT(ADAPTATION_A_UNE_LOI_DE_DISTRIBUTION_QUELCONQUE_____loi_de_distribution_gaussienne__Ntentatives,MILLE))); DEFV(Common,DEFV(Float,ZINT(ADAPTATION_A_UNE_LOI_DE_DISTRIBUTION_QUELCONQUE_____loi_de_distribution_gaussienne__esperance_,FDU))); DEFV(Common,DEFV(Float,ZINT(ADAPTATION_A_UNE_LOI_DE_DISTRIBUTION_QUELCONQUE_____loi_de_distribution_gaussienne__ecart_type ,FRA10(FU) ) ) ); /* La distribution gaussienne a ete introduite ainsi le 20110328114903... */ /* */ /* Le 20110418124934, l'ecart-type est passe de 'FDU' a 'FRA10(FU)' qui donne une courbe */ /* en cloche plus etroite... */ DEFV(Common,DEFV(Logical,ZINT(ADAPTATION_A_UNE_LOI_DE_DISTRIBUTION_QUELCONQUE_____loi_de_distribution_arbitraire_sub__in,VRAI))); DEFV(Local,DEFV(genere_Float,DTb1(ADAPTATION_A_UNE_LOI_DE_DISTRIBUTION_QUELCONQUE_____loi_de_distribution_arbitraire_sub__LFsubst ,COULEURS ) ) ); DEFV(Common,DEFV(Int,ZINT(ADAPTATION_A_UNE_LOI_DE_DISTRIBUTION_QUELCONQUE_____loi_de_distribution_arbitraire_sub__Ntentatives ,MILLE ) ) ); DEFV(Common,DEFV(Logical,ZINT(ADAPTATION_A_UNE_LOI_DE_DISTRIBUTION_QUELCONQUE_____loi_de_distribution_arbitraire_sub__lissage ,VRAI ) ) ); DEFV(Common,DEFV(Int,ZINT(ADAPTATION_A_UNE_LOI_DE_DISTRIBUTION_QUELCONQUE_____loi_de_distribution_arbitraire_sub__Npasses ,UN ) ) ); DEFV(Common,DEFV(Int,ZINT(ADAPTATION_A_UNE_LOI_DE_DISTRIBUTION_QUELCONQUE_____loi_de_distribution_arbitraire_sub__PAS_COL ,PAS_COULEURS ) ) ); /* La loi arbitraire definie par la SUBstitution courante a ete introduite le */ /* 20110401173421... */ #define ADAPTATION_A_UNE_LOI_DE_DISTRIBUTION_QUELCONQUE(calcul_complet_itere_rdn_ND,iterer,graine,loi_distribution,NMax_tentatives) \ /* On notera l'hypothese implicite suivante : */ \ /* */ \ /* loi E [0,1] */ \ /* */ \ /* comme toute distribution de probabilites qui se respecte... */ \ Bblock \ DEFV(Int,INIT(graine_transformee,graine)); \ /* Graine courante qui va etre tres certainement modifiee par la suite... */ \ \ DEFV(Logical,INIT(iterer_la_loi_de_distribution,VRAI)); \ DEFV(Int,INIT(decompteur_de_tentatives,NMax_tentatives)); \ \ Tant(IFET(IL_FAUT(iterer_la_loi_de_distribution) \ ,IZGT(decompteur_de_tentatives) \ ) \ ) \ Bblock \ DEFV(Float,INIT(coordonnee_X,FLOT__UNDEF)); \ DEFV(Float,INIT(coordonnee_Y,FLOT__UNDEF)); \ \ calcul_complet_itere_rdn_ND(iterer,GRO3(graine_transformee)); \ EGAL(coordonnee_X,rdn); \ calcul_complet_itere_rdn_ND(iterer,GRO7(graine_transformee)); \ EGAL(coordonnee_Y,rdn); \ /* On genere ainsi un point {X,Y} aleatoire dans le pave [inf,sup]x[inf,sup]. */ \ \ Test(IFLE(NORM(coordonnee_Y,inf,sup),loi_distribution)) \ /* Jusqu'au 20110406101656 il y avait ici 'NORM(coordonnee_Y,inf,sup)' par erreur, d'ou pour */ \ /* 'ADAPTATION_A_UNE_LOI_DE_DISTRIBUTION_QUELCONQUE(...)' la suppression de ses arguments */ \ /* {min,max}... */ \ Bblock \ EGAL(iterer_la_loi_de_distribution,FAUX); \ EGAL(rdn,coordonnee_X); \ /* Si le point {X,Y} aleatoire est sous la courbe representative de la loi de distribution, */ \ /* alors la coordonnee 'X' est la valeur aleatoire recherchee qui suive cette loi... */ \ Eblock \ ATes \ Bblock \ DECR(decompteur_de_tentatives,I); \ INCR(graine_transformee,I); \ /* Sinon, il faut poursuivre la recherche, mais sans boucler a l'infini... */ \ Eblock \ ETes \ Eblock \ ETan \ Eblock \ /* Adaptation generale a une loi de distribution quelconque (introduit le 20110328145819). */ #define calcul_complet_itere_transforme_rdn_ND(calcul_complet_itere_rdn_ND,iterer,graine) \ Bblock \ Choi(ADAPTATION_A_UNE_LOI_DE_DISTRIBUTION_QUELCONQUE_____loi_de_distribution) \ Bblock \ Ca1e(RDN_UNIFORME) \ Bblock \ calcul_complet_itere_rdn_ND(iterer,graine); \ /* Loi uniforme... */ \ Eblock \ ECa1 \ \ Ca1e(RDN_GAUSSIENNE) \ Bblock \ ADAPTATION_A_UNE_LOI_DE_DISTRIBUTION_QUELCONQUE \ (calcul_complet_itere_rdn_ND \ ,iterer \ ,graine \ ,GAUS(NORM(coordonnee_X,inf,sup) \ ,ADAPTATION_A_UNE_LOI_DE_DISTRIBUTION_QUELCONQUE_____loi_de_distribution_gaussienne__esperance_ \ ,ADAPTATION_A_UNE_LOI_DE_DISTRIBUTION_QUELCONQUE_____loi_de_distribution_gaussienne__ecart_type \ ) \ ,ADAPTATION_A_UNE_LOI_DE_DISTRIBUTION_QUELCONQUE_____loi_de_distribution_gaussienne__Ntentatives \ ); \ /* Loi gaussienne evidemment dans [0,1] afin d'en faire une ditribution de probabilites */ \ /* digne de ce nom... */ \ Eblock \ ECa1 \ \ Ca1e(RDN_ARBITRAIRE_SUB) \ Bblock \ Test(IL_FAUT(ADAPTATION_A_UNE_LOI_DE_DISTRIBUTION_QUELCONQUE_____loi_de_distribution_arbitraire_sub__in)) \ Bblock \ CONVERSION_FLOTTANTE_D_UNE_LISTE_DE_SUBSTITUTION \ (ADAPTATION_A_UNE_LOI_DE_DISTRIBUTION_QUELCONQUE_____loi_de_distribution_arbitraire_sub__LFsubst \ ,PROBABILITE_NULLE \ ,PROBABILITE_UNITE \ ,ADAPTATION_A_UNE_LOI_DE_DISTRIBUTION_QUELCONQUE_____loi_de_distribution_arbitraire_sub__lissage \ ,ADAPTATION_A_UNE_LOI_DE_DISTRIBUTION_QUELCONQUE_____loi_de_distribution_arbitraire_sub__Npasses \ ,ADAPTATION_A_UNE_LOI_DE_DISTRIBUTION_QUELCONQUE_____loi_de_distribution_arbitraire_sub__PAS_COL \ ); \ /* Conversion de la liste de substitution courante en une liste flottante dans [0,1] afin */ \ /* d'en faire une ditribution de probabilites digne de ce nom... */ \ \ EGAL(ADAPTATION_A_UNE_LOI_DE_DISTRIBUTION_QUELCONQUE_____loi_de_distribution_arbitraire_sub__in \ ,FAUX \ ); \ /* L'initialisation est faite, mais elle peut etre redemandee de l'exterieur en forcant */ \ /* la valeur 'VRAI' puisqu'il s'agit d'un common... */ \ Eblock \ ATes \ Bblock \ Eblock \ ETes \ \ ADAPTATION_A_UNE_LOI_DE_DISTRIBUTION_QUELCONQUE \ (calcul_complet_itere_rdn_ND \ ,iterer \ ,graine \ ,ITb1(ADAPTATION_A_UNE_LOI_DE_DISTRIBUTION_QUELCONQUE_____loi_de_distribution_arbitraire_sub__LFsubst \ ,INDX(__DENORMALISE_NIVEAU(NORM(coordonnee_X,inf,sup)),NOIR) \ ) \ ,ADAPTATION_A_UNE_LOI_DE_DISTRIBUTION_QUELCONQUE_____loi_de_distribution_arbitraire_sub__Ntentatives \ ); \ /* Loi arbitraire definie par la SUBstitution courante (introduit le 20110401173421) et */ \ /* dans [0,1] afin d'en faire une ditribution de probabilites digne de ce nom... */ \ Eblock \ ECa1 \ \ Defo \ Bblock \ PRINT_ATTENTION("la loi de distribution demandee n'existe pas et on va utiliser la loi 'UNIFORME'"); \ \ calcul_complet_itere_rdn_ND(iterer,graine); \ /* Loi uniforme... */ \ Eblock \ EDef \ Eblock \ ECho \ Eblock \ /* Calcul itere et transforme de la valeur aleatoire 'rdn' dans [inf,sup] valable pour */ \ /* deux et trois dimensions. */ #define calcul_complet_rdn_ND(sequence_gen_ft,calcul_rdn_nD,valeur,graine) \ Bblock \ EGAL(D_graine,graine); \ /* Graine Dynamique reellement utilisee et initialisee a partir de la graine Argument. */ \ BLOC(sequence_gen_ft); \ /* Calcul des fonctions des coordonnees {x,y[,z]}. */ \ calcul_rdn_nD; \ /* Calcul de la valeur aleatoire 'rdn' dans [inf,sup]. */ \ EGAL(valeur,rdn); \ /* Renvoi de la valeur resultat... */ \ Eblock \ /* Calcul complet de la valeur aleatoire 'rdn' dans [inf,sup] valable pour deux et trois */ \ /* dimensions. */ #define calcul_rdn_2D \ Bblock \ calcul_rdn_ND(ADD2(MUL2(fx,fy) \ ,SOUS(fx,fy) \ ) \ ); \ Eblock \ /* Ainsi (par fx-fy), on "dissymetrise" la fonction des coordonnees */ \ /* 'x' et 'y' ; enfin, on met cette valeur dans le segment [inf,sup] */ \ /* en flottant a deux dimensions. */ #define calcul_complet_rdn_2D(valeur,graine) \ Bblock \ calcul_complet_rdn_ND(BLOC( \ gen_ft(fx,x,INTE,graine2,graine1); \ gen_ft(fy,y,INTE,graine1,graine2); \ /* Calcul des fonctions des coordonnees {x,y}. */ \ ) \ ,calcul_rdn_2D \ ,valeur \ ,graine \ ); \ Eblock \ /* Calcul complet de la valeur aleatoire 'rdn' dans [inf,sup] a deux dimensions. */ #define calcul_complet_itere_rdn_2D(iterer,graine) \ Bblock \ Test(IL_NE_FAUT_PAS(iterer)) \ Bblock \ calcul_complet_rdn_2D(rdn,NEUT(graine)); \ /* Calcul de la valeur aleatoire 'rdn' dans [inf,sup]. */ \ Eblock \ ATes \ Bblock \ DEFV(Float,INIT(rdn_1,FLOT__UNDEF)); \ DEFV(Float,INIT(rdn_2,FLOT__UNDEF)); \ /* Valeurs renvoyees par le generateur. */ \ \ calcul_complet_rdn_2D(rdn_1,GRO1(graine)); \ calcul_complet_rdn_2D(rdn_2,GRO7(graine)); \ EGAL(rdn,COMBINAISON_DE_2_VALEURS_ALEATOIRES(rdn_1,rdn_2)); \ /* Calcul de la valeur aleatoire 'rdn' dans [inf,sup]. */ \ /* */ \ /* On notera le 20110328105003 l'usage de 'GRO1(graine)' contrairement a la procedure */ \ /* 'calcul_complet_itere_rdn_3D(...)' qui utilise 'GRO3(graine)'. Mais cela doit rester */ \ /* ainsi, meme si cela est un peu bizarre, pour des raisons de compatibilite anterieure... */ \ Eblock \ ETes \ Eblock \ /* Calcul itere de la valeur aleatoire 'rdn' dans [inf,sup] a deux dimensions. */ #define calcul_complet_itere_transforme_rdn_2D(iterer,graine) \ Bblock \ calcul_complet_itere_transforme_rdn_ND(calcul_complet_itere_rdn_2D,iterer,graine); \ Eblock \ /* Calcul itere et transforme de la valeur aleatoire 'rdn' dans [inf,sup] a deux dimensions. */ #define calcul_rdn_3D \ Bblock \ calcul_rdn_ND(ADD2(MUL3(fx,fy,fz) \ ,OUEX(SOUS(fx,fy) \ ,fz \ ) \ ) \ ); \ Eblock \ /* Ainsi (par fx-fy), on "dissymetrise" la fonction des coordonnees */ \ /* 'x' et 'y' ; enfin, on met cette valeur dans le segment [inf,sup] */ \ /* en flottant a trois dimensions. */ #define calcul_complet_rdn_3D(valeur,graine) \ Bblock \ calcul_complet_rdn_ND(BLOC( \ gen_ft(fx,x,INTE,graine2,graine1); \ gen_ft(fy,y,INTE,graine3,graine2); \ gen_ft(fz,z,INTE,graine1,graine3); \ /* Calcul des fonctions des coordonnees {x,y,z}. */ \ ) \ ,calcul_rdn_3D \ ,valeur \ ,graine \ ); \ Eblock \ /* Calcul complet de la valeur aleatoire 'rdn' dans [inf,sup] a trois dimensions. */ #define calcul_complet_itere_rdn_3D(iterer,graine) \ Bblock \ Test(IL_NE_FAUT_PAS(iterer)) \ Bblock \ calcul_complet_rdn_3D(rdn,NEUT(graine)); \ /* Calcul de la valeur aleatoire 'rdn' dans [inf,sup]. */ \ Eblock \ ATes \ Bblock \ DEFV(Float,INIT(rdn_1,FLOT__UNDEF)); \ DEFV(Float,INIT(rdn_2,FLOT__UNDEF)); \ /* Valeurs reenvoyees par le generateur. */ \ \ calcul_complet_rdn_3D(rdn_1,GRO3(graine)); \ calcul_complet_rdn_3D(rdn_2,GRO7(graine)); \ EGAL(rdn,COMBINAISON_DE_2_VALEURS_ALEATOIRES(rdn_1,rdn_2)); \ /* Calcul de la valeur aleatoire 'rdn' dans [inf,sup]. */ \ /* */ \ /* On notera le 20110328105003 l'usage de 'GRO3(graine)' contrairement a la procedure */ \ /* 'calcul_complet_itere_rdn_2D(...)' qui utilise 'GRO1(graine)'. Mais cela doit rester */ \ /* ainsi, meme si cela est un peu bizarre, pour des raisons de compatibilite anterieure... */ \ Eblock \ ETes \ Eblock \ /* Calcul itere de la valeur aleatoire 'rdn' dans [inf,sup] a trois dimensions. */ #define calcul_complet_itere_transforme_rdn_3D(iterer,graine) \ Bblock \ calcul_complet_itere_transforme_rdn_ND(calcul_complet_itere_rdn_3D,iterer,graine); \ Eblock \ /* Calcul itere et transforme de la valeur aleatoire 'rdn' dans [inf,sup] a trois */ /* dimensions. */ /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* I N I T I A L I S A T I O N D ' U N G E N E R A T E U R A L E A T O I R E : */ /* */ /*************************************************************************************************************************************/ BFonctionI DEFV(Local,DEFV(FonctionI,init_rdn(inf_arg,sup_arg ,ARGUMENT_POINTEUR(inf),ARGUMENT_POINTEUR(sup) ,ARGUMENT_POINTEUR(sup64) ,ARGUMENT_POINTEUR(unmis),ARGUMENT_POINTEUR(unpis) ) ) ) DEFV(Argument,DEFV(Float,inf_arg)); /* Borne inferieure du generateur ; ATTENTION : cet argument n'est a donner que lors */ /* de l'initialisation... */ DEFV(Argument,DEFV(Float,sup_arg)); /* Borne superieure du generateur ; ATTENTION : cet argument n'est a donner que lors */ /* de l'initialisation... */ DEFV(Argument,DEFV(Float,POINTEUR(inf))); /* Borne inferieure du generateur. */ DEFV(Argument,DEFV(Float,POINTEUR(sup))); /* Borne superieure du generateur, */ DEFV(Argument,DEFV(Float,POINTEUR(sup64))); /* Sup64=(sup/inf64). */ DEFV(Argument,DEFV(Float,POINTEUR(unmis))); /* Unmis=(1-(inf/sup)), */ DEFV(Argument,DEFV(Float,POINTEUR(unpis))); /* Unpis=(inf32*(1+(inf/sup))). */ /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock INIT_ERROR; DEFV(Sfloat,INIT(inf32,FDEUXp31)); /* Deux a la puissance 31, */ DEFV(Sfloat,INIT(inf64,FDEUXp32)); /* Deux a la puissance 32. */ /*..............................................................................................................................*/ Test(IFLE(inf_arg,inf_arg)) Bblock EGAL(INDIRECT(inf),inf_arg); /* Recuperation de la borne inferieure flottante, */ EGAL(INDIRECT(sup),sup_arg); /* Et de la borne superieure. */ Eblock ATes Bblock PRINT_ERREUR("la relation d'ordre ('inferieure <= superieure') n'est pas respectee"); CAL1(Prer2("les bornes valent {%+.^^^,%+.^^^}\n" ,inf_arg ,sup_arg ) ); /* Le 20060105091434, le format "16g" est passe a "^^g" pour plus de souplesse... */ /* */ /* Le 20091123122824, le format "^^g" est passe a "^^^" pour plus de souplesse... */ EGAL(INDIRECT(inf),COORDONNEE_BARYCENTRIQUE_MINIMALE); EGAL(INDIRECT(sup),COORDONNEE_BARYCENTRIQUE_MAXIMALE); CAL1(Prer2("on force {%+.^^^,%+.^^^}\n" ,INDIRECT(inf) ,INDIRECT(sup) ) ); /* Le 20060105091434, le format "16g" est passe a "^^g" pour plus de souplesse... */ /* */ /* Le 20091123122824, le format "^^g" est passe a "^^^" pour plus de souplesse... */ Eblock ETes #ifdef RDN_RETOUR_A_INF_SUP_VERSION_01 EGAL(INDIRECT(unmis) ,SOUS(FLOT(W) ,DIVI(inf_arg,sup_arg) ) ); EGAL(INDIRECT(unpis) ,MUL2(inf32 ,ADD2(FLOT(W) ,DIVI(inf_arg,sup_arg) ) ) ); EGAL(INDIRECT(sup64),DIVI(sup_arg,inf64)); #Aifdef RDN_RETOUR_A_INF_SUP_VERSION_01 #Eifdef RDN_RETOUR_A_INF_SUP_VERSION_01 #ifdef RDN_RETOUR_A_INF_SUP_VERSION_02 EGAL(INDIRECT(unmis),UNDEF); EGAL(INDIRECT(unpis),UNDEF); EGAL(INDIRECT(sup64),UNDEF); #Aifdef RDN_RETOUR_A_INF_SUP_VERSION_02 #Eifdef RDN_RETOUR_A_INF_SUP_VERSION_02 RETU_ERROR; Eblock EFonctionI /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* C H O I X D E L A L O I D E T R A N S F O R M A T I O N : */ /* */ /*************************************************************************************************************************************/ #define GENERATEUR_FORTEMENT_DETERMINISTE(valeur) \ FfTransformUniverselle1(valeur) \ /* Generateur fortement deterministe et arbitraire (introduit le 20220113110446 et mis */ \ /* ici le 20220116095031 afin d'avoir une portee plus generale...). */ \ /* */ \ /* Le 20220116141328, 'SINX(...)' a ete remplace par 'FfTransformUniverselle1(...)', */ \ /* fonction beaucoup plus generale... */ #define LOI_DE_TRANSFORMATION(variable) \ COND(IFEQ(action,RDN_GENERE) \ ,LIO2(NomDeLaFonctionCourante QD@@__ _____ponderation_NEUT \ ,NEUT(variable) \ ,NomDeLaFonctionCourante QD@@__ _____ponderation_GAUS \ ,DENO(GAUS(NORM(variable,inf,sup) \ ,NomDeLaFonctionCourante QD@@__ _____ponderation_GAUS_esperance_ \ ,NomDeLaFonctionCourante QD@@__ _____ponderation_GAUS_ecart_type \ ) \ ,inf \ ,sup \ ) \ ,FZERO \ ) \ ,variable \ ) \ /* Choix de la loi de distribution (introduit le 20110325105228), ce choix se faisant */ \ /* via des ponderations (en general toutes nulles, sauf une egale a un...). */ \ /* */ \ /* Le nom 'LOI_DE_DISTRIBUTION(...)' a ete change en 'LOI_DE_TRANSFORMATION(...)' le */ \ /* 20110328133610. En effet, ce qui est fait ici ne modifie pas la loi de distribution. */ \ /* Cette derniere possibilite a ete finalement introduite le 20110328114903 grace a la */ \ /* procedure 'calcul_complet_itere_transforme_rdn_ND(...)', beaucoup plus "lourde" que */ \ /* ce qui etait fait ici, mais ne marchait finalement pas. En fait cela pourrait etre */ \ /* supprime, mais ayant ete utilise dans 'v $xiaf/$Fnota Debut_listG_PAYT_Y1' doit donc */ \ /* etre conserve... */ /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* G E N E R A T E U R A L E A T O I R E F L O T T A N T 2 D P O U R P O I N T S " E N T I E R S " : */ /* ( R E D O N N A N T L A M E M E V A L E U R A V E C L E S M E M E S A R G U M E N T S ) */ /* */ /*************************************************************************************************************************************/ BFonctionF DEFV(Common,DEFV(Float,SINT(rdnI2D_____ponderation_NEUT,FU))); DEFV(Common,DEFV(Float,SINT(rdnI2D_____ponderation_GAUS,FZERO))); DEFV(Common,DEFV(Float,SINT(rdnI2D_____ponderation_GAUS_esperance_,FDU))); DEFV(Common,DEFV(Float,SINT(rdnI2D_____ponderation_GAUS_ecart_type,FDU))); /* Parametres de selection de la loi de distribution renvoyee (neutre par defaut). Ceci fut */ /* introduit le 20110325105228... */ /* */ /* On notera que les valeurs par defaut garantissent la compatibilite anterieure en forcant */ /* le mode 'NEUT(...)'. */ DEFV(Common,DEFV(Logical,SINT(rdnI2D_____generer_une_valeur_aleatoire,VRAI))); DEFV(Common,DEFV(Float,SINT(rdnI2D_____ponderation_X,FRA5(FRA10(FRA10(FU)))))); DEFV(Common,DEFV(Float,SINT(rdnI2D_____ponderation_Y,FRA5(FRA10(FRA10(FU)))))); DEFV(Common,DEFV(Float,SINT(rdnI2D_____translation_XY,FZERO))); /* Possibilite de ne plus generer une valeur aleatoire, mais plutot une valeur simplement */ /* deterministe (meme si les "vraies" valeurs aleatoires sont elles-aussi deterministes). */ /* Ceci fut introduit le 20220113110446... */ /* */ /* On rappelle le 20220116164238 que 'rdnI2D(...)' utilise des coordonnees denormalisees, */ /* ou de petites valeurs pour {ponderation_X,ponderation_Y}... */ DEFV(Common,DEFV(FonctionF,rdnI2D(ARGUMENT_POINTERs(pointA) ,A_graine ,action ,ARGUMENT_FACULTATIF(inf_arg),ARGUMENT_FACULTATIF(sup_arg) ) ) ) DEFV(Argument,DEFV(pointI_2D,POINTERs(pointA))); /* Point Argument entier. */ DEFV(Argument,DEFV(Int,A_graine)); /* Argument qui est en fait un parametre arbitraire dont depend le resultat. */ DEFV(Argument,DEFV(Int,action)); /* Indicateur precisant l'action a realiser parmi les deux suivantes : */ /* */ /* "RDN_INIT" : afin d'initialiser le generateur aleatoire, */ /* "RDN_GENERE" : afin de generer un nombre aleatoire, */ /* "RDN_INIT_AND_GENERE" : afin d'initialiser le generateur et generer un nombre */ /* aleatoire. */ /* */ DEFV(Argument,DEFV(Float,inf_arg)); /* Borne inferieure du generateur ; ATTENTION : cet argument n'est a donner que lors */ /* de l'initialisation... */ /* On notera que l'on autorise que le segment [inf,sup] se reduise a un point... */ DEFV(Argument,DEFV(Float,sup_arg)); /* Borne superieure du generateur ; ATTENTION : cet argument n'est a donner que lors */ /* de l'initialisation... */ /* On notera que l'on autorise que le segment [inf,sup] se reduise a un point... */ /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock DEFV(Sint,INIT(graine1,gen32_graine(0x12345678))); /* Graine (arbitraire) du generateur aleatoire, */ DEFV(Sint,INIT(graine2,gen32_graine(0x87654321))); /* Autre graine arbitraire. */ genere_donnees_rdn_2D; /*..............................................................................................................................*/ Test(IL_FAUT(rdnI2D_____generer_une_valeur_aleatoire)) Bblock Choi(action) Bblock Ca1e(RDN_INIT) Bblock Test(IFGT(inf_arg,sup_arg)) /* On notera que l'on autorise que le segment [inf,sup] se reduise a un point... */ Bblock PRINT_ERREUR("les bornes du generateur aleatoire ne sont pas correctement ordonnees"); CAL1(Prer2("bornes=(%g,%g)\n",inf_arg,sup_arg)); Eblock ATes Bblock Eblock ETes CALS(init_rdn(inf_arg,sup_arg,ADRESSE(inf),ADRESSE(sup),ADRESSE(sup64),ADRESSE(unmis),ADRESSE(unpis))); /* Initialisation du generateur aleatoire... */ Eblock ECa1 Ca1e(RDN_GENERE) Bblock calcul_complet_itere_transforme_rdn_2D(iterer_la_generation_de_rdnI2D,A_graine); /* Calcul de la valeur aleatoire 'rdn' dans [inf,sup]. */ Test(IFEXff(rdn,inf,sup)) Bblock PRINT_ERREUR("la valeur aleatoire calculee est hors de [inf,sup]"); CAL1(Prer1("valeur aleatoire=%g\n",rdn)); CAL1(Prer2("bornes=(%g,%g)\n",inf,sup)); Eblock ATes Bblock Eblock ETes Eblock ECa1 Ca1e(RDN_INIT_AND_GENERE) Bblock CALS(rdnI2D(pointA,UNDEF,RDN_INIT,inf_arg,sup_arg)); /* Initialisation du generateur, */ EGAL(rdn,rdnI2D(pointA,D_graine,RDN_GENERE,FLOT__ARGUMENT_ABSENT,FLOT__ARGUMENT_ABSENT)); /* Et calcul immediat d'une valeur aleatoire... */ Eblock ECa1 Defo Bblock PRINT_ATTENTION("l'action demandee au generateur 'rdnI2D' n'existe pas"); CAL1(Prer1("cette action a le code %d\n",action)); Eblock EDef Eblock ECho Eblock ATes Bblock EGAL(rdn ,GENERATEUR_FORTEMENT_DETERMINISTE(LIN2(rdnI2D_____ponderation_X,ASI1(pointA,x) ,rdnI2D_____ponderation_Y,ASI1(pointA,y) ,rdnI2D_____translation_XY ) ) ); Eblock ETes RETU(LOI_DE_TRANSFORMATION(rdn)); Eblock EFonctionF /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* G E N E R A T E U R A L E A T O I R E F L O T T A N T 2 D P O U R P O I N T S " F L O T T A N T S " : */ /* ( R E D O N N A N T L A M E M E V A L E U R A V E C L E S M E M E S A R G U M E N T S ) */ /* */ /*************************************************************************************************************************************/ BFonctionF DEFV(Common,DEFV(Float,SINT(rdnF2D_____ponderation_NEUT,FU))); DEFV(Common,DEFV(Float,SINT(rdnF2D_____ponderation_GAUS,FZERO))); DEFV(Common,DEFV(Float,SINT(rdnF2D_____ponderation_GAUS_esperance_,FDU))); DEFV(Common,DEFV(Float,SINT(rdnF2D_____ponderation_GAUS_ecart_type,FDU))); /* Parametres de selection de la loi de distribution renvoyee (neutre par defaut). Ceci fut */ /* introduit le 20110325105228... */ /* */ /* On notera que les valeurs par defaut garantissent la compatibilite anterieure en forcant */ /* le mode 'NEUT(...)'. */ DEFV(Common,DEFV(Logical,SINT(rdnF2D_____generer_une_valeur_aleatoire,VRAI))); DEFV(Common,DEFV(Float,SINT(rdnF2D_____ponderation_X,FU))); DEFV(Common,DEFV(Float,SINT(rdnF2D_____ponderation_Y,FU))); DEFV(Common,DEFV(Float,SINT(rdnF2D_____translation_XY,FZERO))); /* Possibilite de ne plus generer une valeur aleatoire, mais plutot une valeur simplement */ /* deterministe (meme si les "vraies" valeurs aleatoires sont elles-aussi deterministes). */ /* Ceci fut introduit le 20220113110446... */ /* */ /* On rappelle le 20220116164238 que 'rdnF2D(...)' utilise des coordonnees normalisees, */ /* ou des valeurs "unite" pour {ponderation_X,ponderation_Y}... */ DEFV(Common,DEFV(FonctionF,rdnF2D(ARGUMENT_POINTERs(pointA) ,A_graine ,action ,ARGUMENT_FACULTATIF(inf_arg),ARGUMENT_FACULTATIF(sup_arg) ) ) ) DEFV(Argument,DEFV(pointF_2D,POINTERs(pointA))); /* Point Argument flottant. */ DEFV(Argument,DEFV(Int,A_graine)); /* Argument qui est en fait un parametre arbitraire dont depend le resultat. */ DEFV(Argument,DEFV(Int,action)); /* Indicateur precisant l'action a realiser parmi les deux suivantes : */ /* */ /* "RDN_INIT" : afin d'initialiser le generateur aleatoire, */ /* "RDN_GENERE" : afin de generer un nombre aleatoire, */ /* "RDN_INIT_AND_GENERE" : afin d'initialiser le generateur et generer un nombre */ /* aleatoire. */ /* */ DEFV(Argument,DEFV(Float,inf_arg)); /* Borne inferieure du generateur ; ATTENTION : cet argument n'est a donner que lors */ /* de l'initialisation... */ DEFV(Argument,DEFV(Float,sup_arg)); /* Borne superieure du generateur ; ATTENTION : cet argument n'est a donner que lors */ /* de l'initialisation... */ /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock DEFV(Sint,INIT(graine1,gen24_graine(0x12345678))); /* Graine (arbitraire) du generateur aleatoire (attention pas sur 32 bits...), */ DEFV(Sint,INIT(graine2,gen24_graine(0x87654321))); /* Autre graine arbitraire (attention pas sur 32 bits...). */ genere_donnees_rdn_2D; /*..............................................................................................................................*/ Test(IL_FAUT(rdnF2D_____generer_une_valeur_aleatoire)) Bblock Choi(action) Bblock Ca1e(RDN_INIT) Bblock CALS(init_rdn(inf_arg,sup_arg,ADRESSE(inf),ADRESSE(sup),ADRESSE(sup64),ADRESSE(unmis),ADRESSE(unpis))); Eblock ECa1 Ca1e(RDN_GENERE) Bblock calcul_complet_itere_transforme_rdn_2D(iterer_la_generation_de_rdnF2D,A_graine); /* Calcul de la valeur aleatoire 'rdn' dans [inf,sup]. */ Eblock ECa1 Ca1e(RDN_INIT_AND_GENERE) Bblock CALS(rdnF2D(pointA,UNDEF,RDN_INIT,inf_arg,sup_arg)); /* Initialisation du generateur, */ EGAL(rdn,rdnF2D(pointA,D_graine,RDN_GENERE,FLOT__ARGUMENT_ABSENT,FLOT__ARGUMENT_ABSENT)); /* Et calcul immediat d'une valeur aleatoire... */ Eblock ECa1 Defo Bblock PRINT_ATTENTION("l'action demandee au generateur 'rdnF2D' n'existe pas"); CAL1(Prer1("cette action a le code %d\n",action)); Eblock EDef Eblock ECho Eblock ATes Bblock EGAL(rdn ,GENERATEUR_FORTEMENT_DETERMINISTE(LIN2(rdnF2D_____ponderation_X,ASI1(pointA,x) ,rdnF2D_____ponderation_Y,ASI1(pointA,y) ,rdnF2D_____translation_XY ) ) ); Eblock ETes RETU(LOI_DE_TRANSFORMATION(rdn)); Eblock EFonctionF /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* G E N E R A T E U R A L E A T O I R E F L O T T A N T 3 D P O U R P O I N T S " E N T I E R S " : */ /* ( R E D O N N A N T L A M E M E V A L E U R A V E C L E S M E M E S A R G U M E N T S ) */ /* */ /*************************************************************************************************************************************/ BFonctionF DEFV(Common,DEFV(Float,SINT(rdnI3D_____ponderation_NEUT,FU))); DEFV(Common,DEFV(Float,SINT(rdnI3D_____ponderation_GAUS,FZERO))); DEFV(Common,DEFV(Float,SINT(rdnI3D_____ponderation_GAUS_esperance_,FDU))); DEFV(Common,DEFV(Float,SINT(rdnI3D_____ponderation_GAUS_ecart_type,FDU))); /* Parametres de selection de la loi de distribution renvoyee (neutre par defaut). Ceci fut */ /* introduit le 20110325105228... */ /* */ /* On notera que les valeurs par defaut garantissent la compatibilite anterieure en forcant */ /* le mode 'NEUT(...)'. */ DEFV(Common,DEFV(Logical,SINT(rdnI3D_____generer_une_valeur_aleatoire,VRAI))); DEFV(Common,DEFV(Float,SINT(rdnI3D_____ponderation_X,FRA5(FRA10(FRA10(FU)))))); DEFV(Common,DEFV(Float,SINT(rdnI3D_____ponderation_Y,FRA5(FRA10(FRA10(FU)))))); DEFV(Common,DEFV(Float,SINT(rdnI3D_____ponderation_Z,FRA5(FRA10(FRA10(FU)))))); DEFV(Common,DEFV(Float,SINT(rdnI3D_____translation_XYZ,FZERO))); /* Possibilite de ne plus generer une valeur aleatoire, mais plutot une valeur simplement */ /* deterministe (meme si les "vraies" valeurs aleatoires sont elles-aussi deterministes). */ /* Ceci fut introduit le 20220113110446... */ /* */ /* On rappelle le 20220116164238 que 'rdnI3D(...)' utilise des coordonnees denormalisees, */ /* ou de petites valeurs pour {ponderation_X,ponderation_Y,ponderation_Z}... */ DEFV(Common,DEFV(FonctionF,rdnI3D(ARGUMENT_POINTERs(pointA) ,A_graine ,action ,ARGUMENT_FACULTATIF(inf_arg),ARGUMENT_FACULTATIF(sup_arg) ) ) ) DEFV(Argument,DEFV(pointI_3D,POINTERs(pointA))); /* Point Argument entier. */ DEFV(Argument,DEFV(Int,A_graine)); /* Argument qui est en fait un parametre arbitraire dont depend le resultat. */ DEFV(Argument,DEFV(Int,action)); /* Indicateur precisant l'action a realiser parmi les deux suivantes : */ /* */ /* "RDN_INIT" : afin d'initialiser le generateur aleatoire, */ /* "RDN_GENERE" : afin de generer un nombre aleatoire, */ /* "RDN_INIT_AND_GENERE" : afin d'initialiser le generateur et generer un nombre */ /* aleatoire. */ /* */ DEFV(Argument,DEFV(Float,inf_arg)); /* Borne inferieure du generateur ; ATTENTION : cet argument n'est a donner que lors */ /* de l'initialisation... */ DEFV(Argument,DEFV(Float,sup_arg)); /* Borne superieure du generateur ; ATTENTION : cet argument n'est a donner que lors */ /* de l'initialisation... */ /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock DEFV(Sint,INIT(graine1,gen32_graine(0x12345678))); /* Graine (arbitraire) du generateur aleatoire, */ DEFV(Sint,INIT(graine2,gen32_graine(0x87654321))); /* Autre graine arbitraire, */ DEFV(Sint,INIT(graine3,gen32_graine(0xfedcba98))); /* Autre graine arbitraire. */ genere_donnees_rdn_3D; /*..............................................................................................................................*/ Test(IL_FAUT(rdnI3D_____generer_une_valeur_aleatoire)) Bblock Choi(action) Bblock Ca1e(RDN_INIT) Bblock CALS(init_rdn(inf_arg,sup_arg,ADRESSE(inf),ADRESSE(sup),ADRESSE(sup64),ADRESSE(unmis),ADRESSE(unpis))); Eblock ECa1 Ca1e(RDN_GENERE) Bblock calcul_complet_itere_transforme_rdn_3D(iterer_la_generation_de_rdnI3D,A_graine); /* Calcul de la valeur aleatoire 'rdn' dans [inf,sup]. */ Eblock ECa1 Ca1e(RDN_INIT_AND_GENERE) Bblock CALS(rdnI3D(pointA,UNDEF,RDN_INIT,inf_arg,sup_arg)); /* Initialisation du generateur, */ EGAL(rdn,rdnI3D(pointA,D_graine,RDN_GENERE,FLOT__ARGUMENT_ABSENT,FLOT__ARGUMENT_ABSENT)); /* Et calcul immediat d'une valeur aleatoire... */ Eblock ECa1 Defo Bblock PRINT_ATTENTION("l'action demandee au generateur 'rdnI3D' n'existe pas"); CAL1(Prer1("cette action a le code %d\n",action)); Eblock EDef Eblock ECho Eblock ATes Bblock EGAL(rdn ,GENERATEUR_FORTEMENT_DETERMINISTE(LIN3(rdnI3D_____ponderation_X,ASI1(pointA,x) ,rdnI3D_____ponderation_Y,ASI1(pointA,y) ,rdnI3D_____ponderation_Z,ASI1(pointA,z) ,rdnI3D_____translation_XYZ ) ) ); Eblock ETes RETU(LOI_DE_TRANSFORMATION(rdn)); Eblock EFonctionF /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* G E N E R A T E U R A L E A T O I R E F L O T T A N T 3 D P O U R P O I N T S " F L O T T A N T S " : */ /* ( R E D O N N A N T L A M E M E V A L E U R A V E C L E S M E M E S A R G U M E N T S ) */ /* */ /*************************************************************************************************************************************/ BFonctionF DEFV(Common,DEFV(Float,SINT(rdnF3D_____ponderation_NEUT,FU))); DEFV(Common,DEFV(Float,SINT(rdnF3D_____ponderation_GAUS,FZERO))); DEFV(Common,DEFV(Float,SINT(rdnF3D_____ponderation_GAUS_esperance_,FDU))); DEFV(Common,DEFV(Float,SINT(rdnF3D_____ponderation_GAUS_ecart_type,FDU))); /* Parametres de selection de la loi de distribution renvoyee (neutre par defaut). Ceci fut */ /* introduit le 20110325105228... */ /* */ /* On notera que les valeurs par defaut garantissent la compatibilite anterieure en forcant */ /* le mode 'NEUT(...)'. */ DEFV(Common,DEFV(Logical,SINT(rdnF3D_____generer_une_valeur_aleatoire,VRAI))); DEFV(Common,DEFV(Float,SINT(rdnF3D_____ponderation_X,FU))); DEFV(Common,DEFV(Float,SINT(rdnF3D_____ponderation_Y,FU))); DEFV(Common,DEFV(Float,SINT(rdnF3D_____ponderation_Z,FU))); DEFV(Common,DEFV(Float,SINT(rdnF3D_____translation_XYZ,FZERO))); /* Possibilite de ne plus generer une valeur aleatoire, mais plutot une valeur simplement */ /* deterministe (meme si les "vraies" valeurs aleatoires sont elles-aussi deterministes). */ /* Ceci fut introduit le 20220113110446... */ /* */ /* On rappelle le 20220116164238 que 'rdnF3D(...)' utilise des coordonnees normalisees, */ /* ou des valeurs "unite" pour {ponderation_X,ponderation_Y,ponderation_Z}... */ DEFV(Common,DEFV(FonctionF,rdnF3D(ARGUMENT_POINTERs(pointA) ,A_graine ,action ,ARGUMENT_FACULTATIF(inf_arg),ARGUMENT_FACULTATIF(sup_arg) ) ) ) DEFV(Argument,DEFV(pointF_3D,POINTERs(pointA))); /* Point Argument flottant. */ DEFV(Argument,DEFV(Int,A_graine)); /* Argument qui est en fait un parametre arbitraire dont depend le resultat. */ DEFV(Argument,DEFV(Int,action)); /* Indicateur precisant l'action a realiser parmi les deux suivantes : */ /* */ /* "RDN_INIT" : afin d'initialiser le generateur aleatoire, */ /* "RDN_GENERE" : afin de generer un nombre aleatoire, */ /* "RDN_INIT_AND_GENERE" : afin d'initialiser le generateur et generer un nombre */ /* aleatoire. */ /* */ DEFV(Argument,DEFV(Float,inf_arg)); /* Borne inferieure du generateur ; ATTENTION : cet argument n'est a donner que lors */ /* de l'initialisation... */ DEFV(Argument,DEFV(Float,sup_arg)); /* Borne superieure du generateur ; ATTENTION : cet argument n'est a donner que lors */ /* de l'initialisation... */ /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock DEFV(Sint,INIT(graine1,gen24_graine(0x12345678))); /* Graine (arbitraire) du generateur aleatoire (attention pas sur 32 bits...), */ DEFV(Sint,INIT(graine2,gen24_graine(0x87654321))); /* Autre graine arbitraire (attention pas sur 32 bits...), */ DEFV(Sint,INIT(graine3,gen24_graine(0xfedcba98))); /* Autre graine arbitraire (attention pas sur 32 bits...). */ genere_donnees_rdn_3D; /*..............................................................................................................................*/ Test(IL_FAUT(rdnF3D_____generer_une_valeur_aleatoire)) Bblock Choi(action) Bblock Ca1e(RDN_INIT) Bblock CALS(init_rdn(inf_arg,sup_arg,ADRESSE(inf),ADRESSE(sup),ADRESSE(sup64),ADRESSE(unmis),ADRESSE(unpis))); Eblock ECa1 Ca1e(RDN_GENERE) Bblock calcul_complet_itere_transforme_rdn_3D(iterer_la_generation_de_rdnF3D,A_graine); /* Calcul de la valeur aleatoire 'rdn' dans [inf,sup]. */ Eblock ECa1 Ca1e(RDN_INIT_AND_GENERE) Bblock CALS(rdnF3D(pointA,UNDEF,RDN_INIT,inf_arg,sup_arg)); /* Initialisation du generateur, */ EGAL(rdn,rdnF3D(pointA,D_graine,RDN_GENERE,FLOT__ARGUMENT_ABSENT,FLOT__ARGUMENT_ABSENT)); /* Et calcul immediat d'une valeur aleatoire... */ Eblock ECa1 Defo Bblock PRINT_ATTENTION("l'action demandee au generateur 'rdnF3D' n'existe pas"); CAL1(Prer1("cette action a le code %d\n",action)); Eblock EDef Eblock ECho Eblock ATes Bblock EGAL(rdn ,GENERATEUR_FORTEMENT_DETERMINISTE(LIN3(rdnF3D_____ponderation_X,ASI1(pointA,x) ,rdnF3D_____ponderation_Y,ASI1(pointA,y) ,rdnF3D_____ponderation_Z,ASI1(pointA,z) ,rdnF3D_____translation_XYZ ) ) ); Eblock ETes RETU(LOI_DE_TRANSFORMATION(rdn)); Eblock EFonctionF #undef LOI_DE_TRANSFORMATION #undef GENERATEUR_FORTEMENT_DETERMINISTE #undef calcul_complet_itere_transforme_rdn_3D #undef calcul_complet_itere_rdn_3D #undef calcul_complet_rdn_3D #undef calcul_rdn_3D #undef calcul_complet_itere_transforme_rdn_2D #undef calcul_complet_itere_rdn_2D #undef calcul_complet_rdn_2D #undef calcul_rdn_2D #undef ADAPTATION_A_UNE_LOI_DE_DISTRIBUTION_QUELCONQUE #undef calcul_complet_rdn_ND #undef calcul_complet_itere_transforme_rdn_ND #undef COMBINAISON_DE_2_VALEURS_ALEATOIRES #undef COMBINAISON_DE_2_VALEURS_ALEATOIRES_VERSION_07 #Undef COMBINAISON_DE_2_VALEURS_ALEATOIRES_VERSION_06 #Undef COMBINAISON_DE_2_VALEURS_ALEATOIRES_VERSION_05 #Undef COMBINAISON_DE_2_VALEURS_ALEATOIRES_VERSION_04 #Undef COMBINAISON_DE_2_VALEURS_ALEATOIRES_VERSION_03 #Undef COMBINAISON_DE_2_VALEURS_ALEATOIRES_VERSION_02 #Undef COMBINAISON_DE_2_VALEURS_ALEATOIRES_VERSION_01 /* Le 20030222103918, 'COMBINAISON_DE_2_VALEURS_ALEATOIRES_VERSION_0[1-6](...)' */ /* sont passes de 'undef' a 'Undef' afin de ne pas etre recupere par le processus */ /* 'v $xcc/cpp$Z _VERSION_'. */ #ifdef RDN_RETOUR_A_INF_SUP_VERSION_02 # undef calcul_rdn_ND #Aifdef RDN_RETOUR_A_INF_SUP_VERSION_02 #Eifdef RDN_RETOUR_A_INF_SUP_VERSION_02 #ifdef RDN_RETOUR_A_INF_SUP_VERSION_01 # undef calcul_rdn_ND #Aifdef RDN_RETOUR_A_INF_SUP_VERSION_01 #Eifdef RDN_RETOUR_A_INF_SUP_VERSION_01 #undef RDN_RETOUR_A_INF_SUP_VERSION_02 #undef AFFINAGE_DES_VALEURS_ALEATOIRES #undef INITIALISATION_RDN_STANDARD #undef RDN_STANDARD #undef iterer_la_generation_de_rdnF3D #undef iterer_la_generation_de_rdnI3D #undef iterer_la_generation_de_rdnF2D #undef iterer_la_generation_de_rdnI2D #undef gen_ft #undef genX_ft #undef gen7_ft #undef random_gen7_graineB #undef random_gen7_graineA #undef random_gen7_iterations #if ( (! defined(SYSTEME_APC_LinuxDebian_GCC)) \ && (! defined(SYSTEME_APC_LinuxMandrake_GCC)) \ && (! defined(SYSTEME_APC_LinuxRedHat_GCC)) \ && (! defined(SYSTEME_APC_LinuxUbuntu_GCC)) \ && (! defined(SYSTEME_APC_LinuxUbuntu_ICC)) \ && (! defined(SYSTEME_APC_LinuxUlmint_GCC)) \ && (! defined(SYSTEME_APC_LinuxUlmint_ICC)) \ && (! defined(SYSTEME_DECALPHA340_OSF1_CC)) \ && (! defined(SYSTEME_DECALPHA350_OSF1_CC)) \ && (! defined(SYSTEME_DECALPHA464_OSF1_CC)) \ && (! defined(SYSTEME_FX2800_CONCENTRIX_SCC)) \ && (! defined(SYSTEME_SGIND308_IRIX_CC)) \ && (! defined(SYSTEME_SGIND324_IRIX_CC)) \ && (! defined(SYSTEME_SGIND3GA_IRIX_CC)) \ && (! defined(SYSTEME_SGIND408_IRIX_CC)) \ && (! defined(SYSTEME_SGIND424_IRIX_CC)) \ && (! defined(SYSTEME_SGIND4GA_IRIX_CC)) \ && (! defined(SYSTEME_SGIND508_IRIX_CC)) \ && (! defined(SYSTEME_SGIND524_IRIX_CC)) \ && (! defined(SYSTEME_SGIND5GA_IRIX_CC)) \ && (! defined(SYSTEME_SGIND808_IRIX_CC)) \ && (! defined(SYSTEME_SGIND824_IRIX_CC)) \ && (! defined(SYSTEME_SGIND8GA_IRIX_CC)) \ && (! defined(SYSTEME_SGINDA08_IRIX_CC)) \ && (! defined(SYSTEME_SGINDA24_IRIX_CC)) \ && (! defined(SYSTEME_SGINDAGA_IRIX_CC)) \ && (! defined(SYSTEME_SGO200A1_IRIX_CC)) \ && (! defined(SYSTEME_SGO200A2_IRIX_CC)) \ && (! defined(SYSTEME_SGO200A4_IRIX_CC)) \ && (! defined(SYSTEME_SGO25224_IRIX_CC)) \ && (! defined(SYSTEME_SGO252VA_IRIX_CC)) \ && (! defined(SYSTEME_SGO252VN_IRIX_CC)) \ && (! defined(SYSTEME_SGPCM801_IRIX_CC)) \ && (! defined(SYSTEME_SGPCMA01_IRIX_CC)) \ ) # undef gen6_ft # undef MODULO_GEN6 # undef MULTIPLIEUR_GEN6 #Aif ( (! defined(SYSTEME_APC_LinuxDebian_GCC)) \ && (! defined(SYSTEME_APC_LinuxMandrake_GCC)) \ && (! defined(SYSTEME_APC_LinuxRedHat_GCC)) \ && (! defined(SYSTEME_APC_LinuxUbuntu_GCC)) \ && (! defined(SYSTEME_APC_LinuxUbuntu_ICC)) \ && (! defined(SYSTEME_APC_LinuxUlmint_GCC)) \ && (! defined(SYSTEME_APC_LinuxUlmint_ICC)) \ && (! defined(SYSTEME_DECALPHA340_OSF1_CC)) \ && (! defined(SYSTEME_DECALPHA350_OSF1_CC)) \ && (! defined(SYSTEME_DECALPHA464_OSF1_CC)) \ && (! defined(SYSTEME_FX2800_CONCENTRIX_SCC)) \ && (! defined(SYSTEME_SGIND308_IRIX_CC)) \ && (! defined(SYSTEME_SGIND324_IRIX_CC)) \ && (! defined(SYSTEME_SGIND3GA_IRIX_CC)) \ && (! defined(SYSTEME_SGIND408_IRIX_CC)) \ && (! defined(SYSTEME_SGIND424_IRIX_CC)) \ && (! defined(SYSTEME_SGIND4GA_IRIX_CC)) \ && (! defined(SYSTEME_SGIND508_IRIX_CC)) \ && (! defined(SYSTEME_SGIND524_IRIX_CC)) \ && (! defined(SYSTEME_SGIND5GA_IRIX_CC)) \ && (! defined(SYSTEME_SGIND808_IRIX_CC)) \ && (! defined(SYSTEME_SGIND824_IRIX_CC)) \ && (! defined(SYSTEME_SGIND8GA_IRIX_CC)) \ && (! defined(SYSTEME_SGINDA08_IRIX_CC)) \ && (! defined(SYSTEME_SGINDA24_IRIX_CC)) \ && (! defined(SYSTEME_SGINDAGA_IRIX_CC)) \ && (! defined(SYSTEME_SGO200A1_IRIX_CC)) \ && (! defined(SYSTEME_SGO200A2_IRIX_CC)) \ && (! defined(SYSTEME_SGO200A4_IRIX_CC)) \ && (! defined(SYSTEME_SGO25224_IRIX_CC)) \ && (! defined(SYSTEME_SGO252VA_IRIX_CC)) \ && (! defined(SYSTEME_SGO252VN_IRIX_CC)) \ && (! defined(SYSTEME_SGPCM801_IRIX_CC)) \ && (! defined(SYSTEME_SGPCMA01_IRIX_CC)) \ ) # undef gen6_ft #Eif ( (! defined(SYSTEME_APC_LinuxDebian_GCC)) \ && (! defined(SYSTEME_APC_LinuxMandrake_GCC)) \ && (! defined(SYSTEME_APC_LinuxRedHat_GCC)) \ && (! defined(SYSTEME_APC_LinuxUbuntu_GCC)) \ && (! defined(SYSTEME_APC_LinuxUbuntu_ICC)) \ && (! defined(SYSTEME_APC_LinuxUlmint_GCC)) \ && (! defined(SYSTEME_APC_LinuxUlmint_ICC)) \ && (! defined(SYSTEME_DECALPHA340_OSF1_CC)) \ && (! defined(SYSTEME_DECALPHA350_OSF1_CC)) \ && (! defined(SYSTEME_DECALPHA464_OSF1_CC)) \ && (! defined(SYSTEME_FX2800_CONCENTRIX_SCC)) \ && (! defined(SYSTEME_SGIND308_IRIX_CC)) \ && (! defined(SYSTEME_SGIND324_IRIX_CC)) \ && (! defined(SYSTEME_SGIND3GA_IRIX_CC)) \ && (! defined(SYSTEME_SGIND408_IRIX_CC)) \ && (! defined(SYSTEME_SGIND424_IRIX_CC)) \ && (! defined(SYSTEME_SGIND4GA_IRIX_CC)) \ && (! defined(SYSTEME_SGIND508_IRIX_CC)) \ && (! defined(SYSTEME_SGIND524_IRIX_CC)) \ && (! defined(SYSTEME_SGIND5GA_IRIX_CC)) \ && (! defined(SYSTEME_SGIND808_IRIX_CC)) \ && (! defined(SYSTEME_SGIND824_IRIX_CC)) \ && (! defined(SYSTEME_SGIND8GA_IRIX_CC)) \ && (! defined(SYSTEME_SGINDA08_IRIX_CC)) \ && (! defined(SYSTEME_SGINDA24_IRIX_CC)) \ && (! defined(SYSTEME_SGINDAGA_IRIX_CC)) \ && (! defined(SYSTEME_SGO200A1_IRIX_CC)) \ && (! defined(SYSTEME_SGO200A2_IRIX_CC)) \ && (! defined(SYSTEME_SGO200A4_IRIX_CC)) \ && (! defined(SYSTEME_SGO25224_IRIX_CC)) \ && (! defined(SYSTEME_SGO252VA_IRIX_CC)) \ && (! defined(SYSTEME_SGO252VN_IRIX_CC)) \ && (! defined(SYSTEME_SGPCM801_IRIX_CC)) \ && (! defined(SYSTEME_SGPCMA01_IRIX_CC)) \ ) #undef gen5_ft #undef random_gen5 #undef gen4_ft #undef gen3_ft #undef random_17 #undef gen2_ft #undef gen1_ft #undef Coordonnee_non_nulle #undef MoDu #undef gen32_graine #undef gen24_graine /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* G E N E R A T E U R A L E A T O I R E E N T I E R 2 D P O U R P O I N T S " E N T I E R S " : */ /* ( R E D O N N A N T L A M E M E V A L E U R A V E C L E S M E M E S A R G U M E N T S ) */ /* */ /*************************************************************************************************************************************/ BFonctionI DEFV(Common,DEFV(FonctionI,rdnaI2D(ARGUMENT_POINTERs(pointA) ,A_graine ,action ,ARGUMENT_FACULTATIF(inf_arg),ARGUMENT_FACULTATIF(sup_arg) ) ) ) DEFV(Argument,DEFV(pointI_2D,POINTERs(pointA))); /* Point Argument entier. */ DEFV(Argument,DEFV(Int,A_graine)); /* Argument qui est en fait un parametre arbitraire dont depend le resultat. */ DEFV(Argument,DEFV(Int,action)); /* Indicateur precisant l'action a realiser parmi les deux suivantes : */ /* */ /* "RDN_INIT" : afin d'initialiser le generateur aleatoire, */ /* "RDN_GENERE" : afin de generer un nombre aleatoire, */ /* "RDN_INIT_AND_GENERE" : afin d'initialiser le generateur et generer un nombre */ /* aleatoire. */ /* */ DEFV(Argument,DEFV(Float,inf_arg)); /* Borne inferieure du generateur ; ATTENTION : cet argument n'est a donner que lors */ /* de l'initialisation... */ DEFV(Argument,DEFV(Float,sup_arg)); /* Borne superieure du generateur ; ATTENTION : cet argument n'est a donner que lors */ /* de l'initialisation... */ /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock genere_donnees_rdn_2D; /*..............................................................................................................................*/ EGAL(rdn,rdnI2D(pointA,D_graine,action,inf_arg,sup_arg)); /* Calcul d'un nombre aleatoire flottant, la conversion entiere par 'ARRI' se faisant */ /* lors du retour de la fonction... */ RETU(ARRI(rdn)); Eblock EFonctionI /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* G E N E R A T E U R A L E A T O I R E E N T I E R 2 D P O U R P O I N T S " F L O T T A N T S " : */ /* ( R E D O N N A N T L A M E M E V A L E U R A V E C L E S M E M E S A R G U M E N T S ) */ /* */ /*************************************************************************************************************************************/ BFonctionI DEFV(Common,DEFV(FonctionI,rdnaF2D(ARGUMENT_POINTERs(pointA) ,A_graine ,action ,ARGUMENT_FACULTATIF(inf_arg),ARGUMENT_FACULTATIF(sup_arg) ) ) ) DEFV(Argument,DEFV(pointF_2D,POINTERs(pointA))); /* Point Argument flottant. */ DEFV(Argument,DEFV(Int,A_graine)); /* Argument qui est en fait un parametre arbitraire dont depend le resultat. */ DEFV(Argument,DEFV(Int,action)); /* Indicateur precisant l'action a realiser parmi les deux suivantes : */ /* */ /* "RDN_INIT" : afin d'initialiser le generateur aleatoire, */ /* "RDN_GENERE" : afin de generer un nombre aleatoire, */ /* "RDN_INIT_AND_GENERE" : afin d'initialiser le generateur et generer un nombre */ /* aleatoire. */ /* */ DEFV(Argument,DEFV(Float,inf_arg)); /* Borne inferieure du generateur ; ATTENTION : cet argument n'est a donner que lors */ /* de l'initialisation... */ DEFV(Argument,DEFV(Float,sup_arg)); /* Borne superieure du generateur ; ATTENTION : cet argument n'est a donner que lors */ /* de l'initialisation... */ /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock genere_donnees_rdn_2D; /*..............................................................................................................................*/ EGAL(rdn,rdnF2D(pointA,D_graine,action,inf_arg,sup_arg)); /* Calcul d'un nombre aleatoire flottant, la conversion entiere par 'ARRI' se faisant */ /* lors du retour de la fonction... */ RETU(ARRI(rdn)); Eblock EFonctionI /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* G E N E R A T E U R A L E A T O I R E E N T I E R 3 D P O U R P O I N T S " E N T I E R S " : */ /* ( R E D O N N A N T L A M E M E V A L E U R A V E C L E S M E M E S A R G U M E N T S ) */ /* */ /*************************************************************************************************************************************/ BFonctionI DEFV(Common,DEFV(FonctionI,rdnaI3D(ARGUMENT_POINTERs(pointA) ,A_graine ,action ,ARGUMENT_FACULTATIF(inf_arg),ARGUMENT_FACULTATIF(sup_arg) ) ) ) DEFV(Argument,DEFV(pointI_3D,POINTERs(pointA))); /* Point Argument entier. */ DEFV(Argument,DEFV(Int,A_graine)); /* Argument qui est en fait un parametre arbitraire dont depend le resultat. */ DEFV(Argument,DEFV(Int,action)); /* Indicateur precisant l'action a realiser parmi les deux suivantes : */ /* */ /* "RDN_INIT" : afin d'initialiser le generateur aleatoire, */ /* "RDN_GENERE" : afin de generer un nombre aleatoire, */ /* "RDN_INIT_AND_GENERE" : afin d'initialiser le generateur et generer un nombre */ /* aleatoire. */ /* */ DEFV(Argument,DEFV(Float,inf_arg)); /* Borne inferieure du generateur ; ATTENTION : cet argument n'est a donner que lors */ /* de l'initialisation... */ DEFV(Argument,DEFV(Float,sup_arg)); /* Borne superieure du generateur ; ATTENTION : cet argument n'est a donner que lors */ /* de l'initialisation... */ /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock genere_donnees_rdn_3D; /*..............................................................................................................................*/ EGAL(rdn,rdnI3D(pointA,D_graine,action,inf_arg,sup_arg)); /* Calcul d'un nombre aleatoire flottant, la conversion entiere par 'ARRI' se faisant */ /* lors du retour de la fonction... */ RETU(ARRI(rdn)); Eblock EFonctionI /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* G E N E R A T E U R A L E A T O I R E E N T I E R 3 D P O U R P O I N T S " F L O T T A N T S " : */ /* ( R E D O N N A N T L A M E M E V A L E U R A V E C L E S M E M E S A R G U M E N T S ) */ /* */ /*************************************************************************************************************************************/ BFonctionI DEFV(Common,DEFV(FonctionI,rdnaF3D(ARGUMENT_POINTERs(pointA) ,A_graine ,action ,ARGUMENT_FACULTATIF(inf_arg),ARGUMENT_FACULTATIF(sup_arg) ) ) ) DEFV(Argument,DEFV(pointF_3D,POINTERs(pointA))); /* Point Argument flottant. */ DEFV(Argument,DEFV(Int,A_graine)); /* Argument qui est en fait un parametre arbitraire dont depend le resultat. */ DEFV(Argument,DEFV(Int,action)); /* Indicateur precisant l'action a realiser parmi les deux suivantes : */ /* */ /* "RDN_INIT" : afin d'initialiser le generateur aleatoire, */ /* "RDN_GENERE" : afin de generer un nombre aleatoire, */ /* "RDN_INIT_AND_GENERE" : afin d'initialiser le generateur et generer un nombre */ /* aleatoire. */ /* */ DEFV(Argument,DEFV(Float,inf_arg)); /* Borne inferieure du generateur ; ATTENTION : cet argument n'est a donner que lors */ /* de l'initialisation... */ DEFV(Argument,DEFV(Float,sup_arg)); /* Borne superieure du generateur ; ATTENTION : cet argument n'est a donner que lors */ /* de l'initialisation... */ /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock genere_donnees_rdn_3D; /*..............................................................................................................................*/ EGAL(rdn,rdnF3D(pointA,D_graine,action,inf_arg,sup_arg)); /* Calcul d'un nombre aleatoire flottant, la conversion entiere par 'ARRI' se faisant */ /* lors du retour de la fonction... */ RETU(ARRI(rdn)); Eblock EFonctionI #undef genere_donnees_rdn_3D #undef genere_donnees_rdn_2D #undef genere_donnees_rdn /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* G E N E R A T E U R A L E A T O I R E F L O T T A N T 2 D P O U R P O I N T S " F L O T T A N T S " : */ /* ( R E D O N N A N T L A M E M E V A L E U R A V E C L E S M E M E S A R G U M E N T S ) */ /* ( E T C E M E M E A V E C D E P E T I T E S C O O R D O N N E E S F L O T T A N T E S ) */ /* */ /*************************************************************************************************************************************/ BFonctionF DEFV(Common,DEFV(Float,SINT(rdnF2D_etendu_____extension,FLOT(MILLE)))); /* Facteur d'extension des coordonnees du point argument. */ DEFV(Common,DEFV(FonctionF,rdnF2D_etendu(ARGUMENT_POINTERs(pointA) ,A_graine ,action ,ARGUMENT_FACULTATIF(inf_arg),ARGUMENT_FACULTATIF(sup_arg) ) ) ) DEFV(Argument,DEFV(pointF_2D,POINTERs(pointA))); /* Point Argument flottant. */ DEFV(Argument,DEFV(Int,A_graine)); /* Argument qui est en fait un parametre arbitraire dont depend le resultat. */ DEFV(Argument,DEFV(Int,action)); /* Indicateur precisant l'action a realiser parmi les deux suivantes : */ /* */ /* "RDN_INIT" : afin d'initialiser le generateur aleatoire, */ /* "RDN_GENERE" : afin de generer un nombre aleatoire, */ /* "RDN_INIT_AND_GENERE" : afin d'initialiser le generateur et generer un nombre */ /* aleatoire. */ /* */ DEFV(Argument,DEFV(Float,inf_arg)); /* Borne inferieure du generateur ; ATTENTION : cet argument n'est a donner que lors */ /* de l'initialisation... */ DEFV(Argument,DEFV(Float,sup_arg)); /* Borne superieure du generateur ; ATTENTION : cet argument n'est a donner que lors */ /* de l'initialisation... */ /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock DEFV(pointF_2D,point_etendu); /* Definition d'un point etendu. */ DEFV(Float,INIT(valeur_aleatoire,FLOT__UNDEF)); /* Variable intermediaire introduite le 20220113105743... */ /*..............................................................................................................................*/ INITIALISATION_POINT_2D(point_etendu ,MUL2(rdnF2D_etendu_____extension,ASI1(pointA,x)) ,MUL2(rdnF2D_etendu_____extension,ASI1(pointA,y)) ); /* Generation du point etendu. */ EGAL(valeur_aleatoire,rdnF2D(ADRESSE(point_etendu),A_graine,action,inf_arg,sup_arg)); RETU(valeur_aleatoire); Eblock EFonctionF /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* G E N E R A T E U R A L E A T O I R E F L O T T A N T 3 D P O U R P O I N T S " F L O T T A N T S " : */ /* ( R E D O N N A N T L A M E M E V A L E U R A V E C L E S M E M E S A R G U M E N T S ) */ /* ( E T C E M E M E A V E C D E P E T I T E S C O O R D O N N E E S F L O T T A N T E S ) */ /* */ /*************************************************************************************************************************************/ BFonctionF DEFV(Common,DEFV(Float,SINT(rdnF3D_etendu_____extension,FLOT(MILLE)))); /* Facteur d'extension des coordonnees du point argument. */ DEFV(Common,DEFV(FonctionF,rdnF3D_etendu(ARGUMENT_POINTERs(pointA) ,A_graine ,action ,ARGUMENT_FACULTATIF(inf_arg),ARGUMENT_FACULTATIF(sup_arg) ) ) ) DEFV(Argument,DEFV(pointF_3D,POINTERs(pointA))); /* Point Argument flottant. */ DEFV(Argument,DEFV(Int,A_graine)); /* Argument qui est en fait un parametre arbitraire dont depend le resultat. */ DEFV(Argument,DEFV(Int,action)); /* Indicateur precisant l'action a realiser parmi les deux suivantes : */ /* */ /* "RDN_INIT" : afin d'initialiser le generateur aleatoire, */ /* "RDN_GENERE" : afin de generer un nombre aleatoire, */ /* "RDN_INIT_AND_GENERE" : afin d'initialiser le generateur et generer un nombre */ /* aleatoire. */ /* */ DEFV(Argument,DEFV(Float,inf_arg)); /* Borne inferieure du generateur ; ATTENTION : cet argument n'est a donner que lors */ /* de l'initialisation... */ DEFV(Argument,DEFV(Float,sup_arg)); /* Borne superieure du generateur ; ATTENTION : cet argument n'est a donner que lors */ /* de l'initialisation... */ /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock DEFV(pointF_3D,point_etendu); /* Definition d'un point etendu. */ DEFV(Float,INIT(valeur_aleatoire,FLOT__UNDEF)); /* Variable intermediaire introduite le 20220113105743... */ /*..............................................................................................................................*/ INITIALISATION_POINT_3D(point_etendu ,MUL2(rdnF3D_etendu_____extension,ASI1(pointA,x)) ,MUL2(rdnF3D_etendu_____extension,ASI1(pointA,y)) ,MUL2(rdnF3D_etendu_____extension,ASI1(pointA,z)) ); /* Generation du point etendu. */ EGAL(valeur_aleatoire,rdnF3D(ADRESSE(point_etendu),A_graine,action,inf_arg,sup_arg)); RETU(valeur_aleatoire); Eblock EFonctionF _______________________________________________________________________________________________________________________________________ _______________________________________________________________________________________________________________________________________ /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* G E N E R A T E U R I T E R A T I F A P E R I O D I C I T E P R O G R A M M A B L E : */ /* */ /* */ /* Principe : */ /* Ce code a ete obtenu a partir du */ /* programme 'v $xtc/MailleCer.01$c'. */ /* L'idee consiste a determiner les */ /* intersections d'une droite a la */ /* pente "pas trop rationnelle" (en */ /* notant qu'evidemment cela n'a que */ /* peu de sens a cause du fait que les */ /* nombres Reels sont traduits en nombres */ /* flottants...) avec une famille de */ /* cercles centres sur un reseau carre */ /* de pas unite, et dont les rayons sont */ /* eux-memes aleatoires... */ /* */ /*************************************************************************************************************************************/ BFonctionF #define X_POINT_DE_DEPART_DU_PARCOURS_DE_LA_DROITE \ FLOT(k___Xmin) #define Y_POINT_DE_DEPART_DU_PARCOURS_DE_LA_DROITE \ FLOT(k___Ymin) DEFV(Common,DEFV(pointF_2D,SINS(rdn_iteratif_cercle_____point_courant_sur_la_droite ,IstructL02(X_POINT_DE_DEPART_DU_PARCOURS_DE_LA_DROITE ,Y_POINT_DE_DEPART_DU_PARCOURS_DE_LA_DROITE ) ) ) ); DEFV(Common,DEFV(Float,SINT(rdn_iteratif_cercle_____pente_A_de_la_droite,PI))); DEFV(Common,DEFV(Float,SINT(rdn_iteratif_cercle_____ordonnee_a_l_origine_B_de_la_droite,FZERO))); DEFV(Common,DEFV(Float,SINT(rdn_iteratif_cercle_____pas_de_parcours_de_la_droite,FRA10(FU)))); /* Definition de la droite par sa pente 'A', son ordonnee a l'origine 'B' et le pas de */ /* parcours. */ DEFV(Common,DEFV(Float,SINT(rdn_iteratif_cercle_____rayon_minimal_des_cercles,FU))); DEFV(Common,DEFV(Float,SINT(rdn_iteratif_cercle_____facteur_d_extension_du_rayon_des_cercles,FQUATRE))); /* Definition du cercle par son rayon 'R' minimal et un facteur d'extension 'F'. */ /* afin de determiner le rayon effectif des cercles qui peut etre soit fixe (F=0) */ /* soit module aleatoirement par 'random' de l'iteration precedente (F#0). On notera */ /* que pour des valeurs superieures a 4, les images aleatoires que l'on peut generer avec */ /* 'rdn_iteratif_cercle(...)' semblent bien aleatoires... */ DEFV(Common,DEFV(Positive,SINT(rdn_iteratif_cercle_____nombre_de_nombres_aleatoires_a_sauter,ZERO))); /* Nombre de nombres aleatoires a sauter. */ DEFV(Common,DEFV(Logical,SINT(rdn_iteratif_cercle_____prendre_la_premiere_racine,VRAI))); /* Pour alterner le choix entre la premiere et la deuxieme racines reelles lorsque le */ /* discriminant de l'equation du second degre est strictement positif... */ DEFV(Common,DEFV(Float,SINT(rdn_iteratif_cercle_____nombre_aleatoire_courant,FZERO))); /* Nombre aleatoire courant. On notera qu'il peut jouer le role de la 'graine' lors du */ /* premier appel a 'rdn_iteratif_cercle(...)' puisqu'il est utilise pour determiner le */ /* rayon effectif du cercle courant lors de la generation du nombre aleatoire suivant */ /* qui est le futur 'rdn_iteratif_cercle_____nombre_aleatoire_courant'...). */ DEFV(Local,DEFV(pointF_2D,INIS(centre_du_cercle_precedent ,IstructL02(F_MOINS_L_INFINI ,F_MOINS_L_INFINI ) ) ) ); /* Centre du cercle precedent. */ DEFV(Common,DEFV(FonctionF,rdn_iteratif_cercle())) /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock DEFV(Logical,INIT(iterer_la_generation,VRAI)); /* Tant que l'on n'a pas trouve de nombre, on doit iterer... */ DEFV(Int,INIT(nombre_de_nombres_aleatoires_a_sauter,rdn_iteratif_cercle_____nombre_de_nombres_aleatoires_a_sauter)); /* Nombre de nombres aleatoires a sauter au cours de cette generation... */ /*..............................................................................................................................*/ Test(IZLT(rdn_iteratif_cercle_____facteur_d_extension_du_rayon_des_cercles)) Bblock PRINT_ATTENTION("le rayon des cercles va etre trop petit, alors il y aura peu ou pas d'intersections avec la droite"); /* En effet, des cercles de rayon inferieur a 1 sur le reseau carre de pas vont permettre */ /* a un espace connexe infini d'exister dans le plan et dans lequel pourrait se situer la */ /* droite. On notera qu'un rayon n'est pas genant car c'est son carre qui intervient... */ Eblock ATes Bblock Eblock ETes Tant(IL_FAUT(iterer_la_generation)) Bblock DEFV(pointF_2D,INIS(centre_du_cercle_courant ,IstructL02(FLOT__UNDEF ,FLOT__UNDEF ) ) ); /* Centre du cercle courant. */ EGAL(ASD1(centre_du_cercle_courant,x),AINT(ASD1(rdn_iteratif_cercle_____point_courant_sur_la_droite,x))); EGAL(ASD1(centre_du_cercle_courant,y),AINT(ASD1(rdn_iteratif_cercle_____point_courant_sur_la_droite,y))); /* Centre du cercle courant. */ Test(IFOU(IFNE(ASD1(centre_du_cercle_courant,x),ASD1(centre_du_cercle_precedent,x)) ,IFNE(ASD1(centre_du_cercle_courant,y),ASD1(centre_du_cercle_precedent,y)) ) ) Bblock /* Cas ou le cercle courant est different du cercle precedent, on peut l'utiliser. */ DEFV(Float,INIT(equation_d_intersection_A,FLOT__UNDEF)); DEFV(Float,INIT(equation_d_intersection_B,FLOT__UNDEF)); DEFV(Float,INIT(equation_d_intersection_C,FLOT__UNDEF)); DEFV(Float,INIT(equation_d_intersection_Discriminant,FLOT__UNDEF)); /* Definition de l'equation du second degre donnant l'intersection entre le cercle */ /* courant et la droite. L'equation de la droite est : */ /* */ /* Y = A.X + B */ /* */ /* et celle du cercle : */ /* */ /* 2 2 2 */ /* (X - X ) + (Y - Y ) = (R + F.rdn) */ /* c c */ /* */ /* ou 'F' designe 'rdn_iteratif_cercle_____facteur_d_extension_du_rayon_des_cercles' et */ /* 'rdn' designe 'rdn_iteratif_cercle_____nombre_aleatoire_courant'. */ EGAL(equation_d_intersection_A ,ADD2(FU,EXP2(rdn_iteratif_cercle_____pente_A_de_la_droite)) ); EGAL(equation_d_intersection_B ,DOUB(SOUS(MUL2(rdn_iteratif_cercle_____pente_A_de_la_droite ,SOUS(rdn_iteratif_cercle_____ordonnee_a_l_origine_B_de_la_droite ,ASD1(centre_du_cercle_courant,y) ) ) ,ASD1(centre_du_cercle_courant,x) ) ) ); EGAL(equation_d_intersection_C ,ADD3(EXP2(ASD1(centre_du_cercle_courant,x)) ,EXP2(SOUS(rdn_iteratif_cercle_____ordonnee_a_l_origine_B_de_la_droite ,ASD1(centre_du_cercle_courant,y) ) ) ,NEGA(EXP2(AXPB(rdn_iteratif_cercle_____facteur_d_extension_du_rayon_des_cercles ,rdn_iteratif_cercle_____nombre_aleatoire_courant ,rdn_iteratif_cercle_____rayon_minimal_des_cercles ) ) ) ) ); /* Calcul des 3 coefficients {A,B,C} de cette equation du second degre. */ EGAL(equation_d_intersection_Discriminant ,DISCRIMINANT2(equation_d_intersection_A,equation_d_intersection_B,equation_d_intersection_C) ); /* Calcul du discriminant de cette equation du second degre. */ /* */ /* L'operateur 'DISCRIMINANT2(...)' a ete introduit ici le 20110325112130... */ Test(IZLT(equation_d_intersection_Discriminant)) Bblock /* Lorsqu'il n'y a pas d'intersection, on ne peut rien generer... */ Eblock ATes Bblock Test(IZEQ(equation_d_intersection_Discriminant)) Bblock /* Cas d'une racine double : */ DEFV(Float,INIT(racine_double ,DIVI(NEGA(equation_d_intersection_B) ,DOUB(equation_d_intersection_A) ) ) ); EGAL(rdn_iteratif_cercle_____nombre_aleatoire_courant,racine_double); /* L'intersection unique entre le cercle et la droite va generer 'random'. */ Eblock ATes Bblock /* Cas de deux racines reelles : */ DEFV(Float,INIT(racine_reelle_1 ,DIVI(SOUS(NEGA(equation_d_intersection_B) ,RACX(equation_d_intersection_Discriminant) ) ,DOUB(equation_d_intersection_A) ) ) ); DEFV(Float,INIT(racine_reelle_2 ,DIVI(ADD2(NEGA(equation_d_intersection_B) ,RACX(equation_d_intersection_Discriminant) ) ,DOUB(equation_d_intersection_A) ) ) ); Test(IL_FAUT(rdn_iteratif_cercle_____prendre_la_premiere_racine)) Bblock EGAL(rdn_iteratif_cercle_____nombre_aleatoire_courant,racine_reelle_1); /* L'intersection de gauche entre le cercle et la droite va generer 'random'. */ Eblock ATes Bblock EGAL(rdn_iteratif_cercle_____nombre_aleatoire_courant,racine_reelle_2); /* L'intersection de droite entre le cercle et la droite va generer 'random'. */ Eblock ETes EGAL(rdn_iteratif_cercle_____prendre_la_premiere_racine ,NOTL(rdn_iteratif_cercle_____prendre_la_premiere_racine) ); /* Bascule du choix entre la racine de Gauche (1) et celle de Droite (2). */ Eblock ETes EGAL(rdn_iteratif_cercle_____nombre_aleatoire_courant ,SOUS(rdn_iteratif_cercle_____nombre_aleatoire_courant ,AINT(rdn_iteratif_cercle_____nombre_aleatoire_courant) ) ); /* Ensuite, on ne garde que la partie decimale de 'random'. */ Test(IZEQ(nombre_de_nombres_aleatoires_a_sauter)) Bblock EGAL(iterer_la_generation,FAUX); /* Lorsque l'on a saute suffisamment de nombres, on s'arrete... */ Eblock ATes Bblock DECR(nombre_de_nombres_aleatoires_a_sauter,I); Eblock ETes Eblock ETes EGAL(ASD1(centre_du_cercle_precedent,x),ASD1(centre_du_cercle_courant,x)); EGAL(ASD1(centre_du_cercle_precedent,y),ASD1(centre_du_cercle_courant,y)); /* Le cercle courant devient le cercle precedent... */ Eblock ATes Bblock /* Cas ou le cercle courant est identique au cercle precedent, on ne peut l'utiliser. */ Eblock ETes INCR(ASD1(rdn_iteratif_cercle_____point_courant_sur_la_droite,x) ,ADD2(rdn_iteratif_cercle_____pas_de_parcours_de_la_droite ,rdn_iteratif_cercle_____nombre_aleatoire_courant ) ); EGAL(ASD1(rdn_iteratif_cercle_____point_courant_sur_la_droite,y) ,AXPB(rdn_iteratif_cercle_____pente_A_de_la_droite ,ASD1(rdn_iteratif_cercle_____point_courant_sur_la_droite,x) ,rdn_iteratif_cercle_____ordonnee_a_l_origine_B_de_la_droite ) ); /* Progression du point courant. On notera que la droite est parcourue de facon irreguliere */ /* telle que : */ /* */ /* X = X + pas + rdn */ /* */ /* ce qui participe a la rupture de la pseudo-periodicite des resultats (ou 'rdn' designe */ /* 'rdn_iteratif_cercle_____nombre_aleatoire_courant'). */ Eblock ETan RETU(rdn_iteratif_cercle_____nombre_aleatoire_courant); Eblock #undef Y_POINT_DE_DEPART_DU_PARCOURS_DE_LA_DROITE #undef X_POINT_DE_DEPART_DU_PARCOURS_DE_LA_DROITE EFonctionF _______________________________________________________________________________________________________________________________________