random numbers !
bom brill
bombrill_gmp@yahoo.fr
Wed, 18 Dec 2002 15:40:02 +0100 (CET)
--0-196047501-1040222402=:89230
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
I really have a problem with the mpz_urandomb() function. Perhaps I don t understand, but, for me, if I have that code :
#include <gmp.h>
int main (int argc, char **argv)
{
gmp_randstate_t state;
mpz_t nbre1, nbre2;
/* Initialisation */
mpz_init (nbre1);
mpz_init (nbre2);
gmp_randinit_default (state);
/* on genere deux nbres de 10 bits */
mpz_urandomb (nbre1, state, 10);
mpz_urandomb (nbre2, state, 10);
gmp_printf ("nbre1 : %Zd \n nbre2 : %Zd \n", nbre1, nbre2);
gmp_randclear (state);
mpz_clear (nbre1);
mpz_clear (nbre2);
return 0;
}
So, I expect, that each time, I'll run the programm, I'll get some new numbers.. because they are chosen randomly.. but it's not the case, and I always get the same..
Would you please help me ?? =))
Thanx anyway.. and sorry about my english ! ... I'm french !
jeremie
---------------------------------
Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !
Testez le nouveau Yahoo! Mail
--0-196047501-1040222402=:89230
Content-Type: text/html; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
<P>I really have a problem with the mpz_urandomb() function. Perhaps I don t understand, but, for me, if I have that code : </P>
<P>#include <gmp.h><BR>int main (int argc, char **argv)<BR>{<BR> gmp_randstate_t state;<BR> mpz_t nbre1, nbre2;</P>
<P><BR> /* Initialisation */<BR> mpz_init (nbre1);<BR> mpz_init (nbre2);<BR> gmp_randinit_default (state);<BR></P>
<P> /* on genere deux nbres de 10 bits */<BR> mpz_urandomb (nbre1, state, 10); </P>
<P> mpz_urandomb (nbre2, state, 10); </P>
<P> gmp_printf ("nbre1 : %Zd \n nbre2 : %Zd \n", nbre1, nbre2);<BR><BR> gmp_randclear (state);<BR> mpz_clear (nbre1);<BR> mpz_clear (nbre2);<BR><BR> return 0;<BR>}<BR></P>
<P>So, I expect, that each time, I'll run the programm, I'll get some new numbers.. because they are chosen randomly.. but it's not the case, and I always get the same..</P>
<P>Would you please help me ?? =))</P>
<P> </P>
<P>Thanx anyway.. and sorry about my english ! ... I'm french !</P>
<P> </P>
<P>jeremie</P><p><br><hr size=1>Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !<br>
<a href=http://fr.mail.yahoo.com>Testez le nouveau Yahoo! Mail</a>
--0-196047501-1040222402=:89230--