From: simon Date: Mon, 17 Oct 2005 18:32:24 +0000 (+0000) Subject: Just noticed a longhand shuffling operation which I must have missed X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/puzzles/commitdiff_plain/e3edcacd267808a4efbc55c0977ccf0d0e3e7963 Just noticed a longhand shuffling operation which I must have missed when I converted them all into calls to shuffle(). git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6404 cda61777-01e9-0310-a592-d414129be87e --- diff --git a/net.c b/net.c index 29a3a27..f8811a7 100644 --- a/net.c +++ b/net.c @@ -897,14 +897,7 @@ static void perturb(int w, int h, unsigned char *tiles, int wrapping, perim2 = snewn(nperim, struct xyd); memcpy(perim2, perimeter, nperim * sizeof(struct xyd)); /* Shuffle the perimeter, so as to search it without directional bias. */ - for (i = nperim; --i ;) { - int j = random_upto(rs, i+1); - struct xyd t; - - t = perim2[j]; - perim2[j] = perim2[i]; - perim2[i] = t; - } + shuffle(perim2, nperim, sizeof(*perim2), rs); for (i = 0; i < nperim; i++) { int x2, y2;