1 /* mk-tdata.c - Create some simple random testdata
2 * Copyright (C) 1998, 1999, 2000, 2001, 2006 Free Software Foundation, Inc.
4 * This file is free software; as a special exception the author gives
5 * unlimited permission to copy and/or distribute it, with or without
6 * modifications, as long as this notice is preserved.
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
10 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
22 #ifndef RAND_MAX /* for SunOS */
23 #define RAND_MAX 32767
27 main(int argc
, char **argv
)
39 /* Check for option --char N */
40 if (argc
> 1 && !strcmp (argv
[0], "--char"))
43 c
= strtol (argv
[1], NULL
, 0);
48 limit
= argc
? atoi(argv
[0]) : 0;
52 for (i
=0; !limit
|| i
< limit
; i
++ )
61 c
= ((unsigned)(1 + (int) (256.0*rand()/(RAND_MAX
+1.0)))-1);
63 c
= ((unsigned)(1 + (int) (256.0*random()/(RAND_MAX
+1.0)))-1);