File: randtest.5c

package info (click to toggle)
nickle 2.54-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 2,140 kB
  • ctags: 3,259
  • sloc: ansic: 30,617; yacc: 1,845; lex: 843; sh: 831; makefile: 206
file content (21 lines) | stat: -rw-r--r-- 396 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
 * Check the PRNG for a balanced low bit
 *
 * Copyright © 2001  Bart Massey.
 * All Rights Reserved.  See the file COPYING in this directory
 * for licensing information.
 *
 * Bart 2001/3
 */

autoimport PRNG;

int[*] function t(int n) {
  int[2] s = {0, 0};
  int i;
  for (i = 0; i < n; i++)
    s[randint(2)]++;
  return s;
}

File::vprintf ("%d %d\n", t (string_to_integer (argv[1])));