[petsc-users] Same random number

mailinglist mailinglistxf at yahoo.fr
Wed Nov 20 05:36:17 CST 2013


Hello,

I use Petsc random number generator. Every time I launch the code I get 
same random number, the code is like this:

   PetscRandom rnd;
   PetscRandomCreate(PETSC_COMM_WORLD,&rnd);
   PetscRandomSetType(rnd,PETSCRAND);

   PetscScalar r;
   PetscRandomGetValue(rnd,&r);

I would like to ask two questions. How could I get different random 
number? And what's the difference bewteen PETSCRAND and PETSCRAND48?

Thank you very much!

Feng XING


More information about the petsc-users mailing list