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