mpz_urandomm function return the same value

Joerg Arndt arndt at jjj.de
Wed Sep 21 20:47:44 CEST 2011


What about using your brain and reading the docs for a start?

* Creatxr <creatxr at gmail.com> [Sep 21. 2011 20:16]:
> Hi,
> could somebody tell me why it always the same value with function
> "mpz_unrandmm".
> thanks.
> ----------------------------------------------------------------
>     mpz_t rop, n;
>     gmp_randstate_t state;
>     mpz_init(rop); mpz_init(n);
>     gmp_randinit_default(state);
> 
>     mpz_set_ui(n, o);
>     mpz_urandomm(rop, state, n);   ////////////////// rop return the same value
>     r.setValue(rop); //////////////////set rop the r object field, rop
> is always the same value
> 
>     gmp_randclear(state);
>     mpz_clear(rop); mpz_clear(n);
> _______________________________________________
> gmp-discuss mailing list
> gmp-discuss at gmplib.org
> https://gmplib.org/mailman/listinfo/gmp-discuss


More information about the gmp-discuss mailing list