Why not just set each index with hash(i) = (i >> 32)^i and forget VecSetRandom in here? This does not have to be perfectly decorrelated. Just not perfectly correlated.
{ PetscErrorCode ierr; PetscInt n = xin->map->n,i; PetscScalar *xx; PetscFunctionBegin; ierr = VecGetArray(xin,&xx);CHKERRQ(ierr); for (i=0; i<n; i++) xx[i] = hash(i+start); ierr = VecRestoreArray(xin,&xx);CHKERRQ(ierr); PetscFunctionReturn(0); } On Tue, May 17, 2016 at 3:41 PM, Matthew Knepley <knep...@gmail.com> wrote: > On Tue, May 17, 2016 at 2:34 PM, Jed Brown <j...@jedbrown.org> wrote: > >> Matthew Knepley <knep...@gmail.com> writes: >> > Should we just make this another Random implementation which is only for >> > testing? >> >> The problem is that we want to produce the same numbers on one process >> and on many processes. The interface doesn't really afford that because >> it provides a stream of numbers. If we know the number of entries we're >> about to ask for on each process, we could do a Scan to find the >> starting index and "seed" with that, where drawing a number hashes and >> increments the counter. But this is pretty contorted. >> > > It seems like we should do double dispatch for VecSetRandom(). > > Matt > > -- > What most experimenters take for granted before they begin their > experiments is infinitely more interesting than any results to which their > experiments lead. > -- Norbert Wiener >