MCPcopy Create free account
hub / github.com/NetHack/NetHack / shuffle_int_array

Function shuffle_int_array

src/rnd.c:298–310  ·  view source on GitHub ↗

randomize the given list of numbers 0 <= i < count */

Source from the content-addressed store, hash-verified

296
297/* randomize the given list of numbers 0 <= i < count */
298void
299shuffle_int_array(int *indices, int count)
300{
301 int i, iswap, temp;
302
303 for (i = count - 1; i > 0; i--) {
304 if ((iswap = rn2(i + 1)) == i)
305 continue;
306 temp = indices[i];
307 indices[i] = indices[iswap];
308 indices[iswap] = temp;
309 }
310}
311
312/*rnd.c*/

Callers 1

use_unicorn_hornFunction · 0.85

Calls 1

rn2Function · 0.85

Tested by

no test coverage detected