File: randomize.c

package info (click to toggle)
netrek-client-cow 3.3.0-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, wheezy
  • size: 6,196 kB
  • ctags: 5,158
  • sloc: ansic: 43,111; sh: 2,820; python: 380; makefile: 133; sed: 16
file content (22 lines) | stat: -rw-r--r-- 339 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include "config.h"

/* randomize argv's - stolen from beorn
 *
 */
main (ac, av)
     int ac;
     char *av[];
{
  int i, j;

  SRANDOM ((getuid () << 7) ^ (getpid () << 4) ^ time (0));

  for (i = ac - 1; i; i--)
    {
      j = (RANDOM () % i) + 1;
      printf ("%s ", av[j]);
      av[j] = av[i];
    }
  printf ("\n");
  exit (0);
}