2 * GRUB -- GRand Unified Bootloader
3 * Copyright (C) 2013 Free Software Foundation, Inc.
5 * GRUB is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * GRUB is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
19 /* Standard random generator is slow. For FS testing we need just some
20 garbage files, we don't need them to be high-quality random.
28 static unsigned long long buffer
[1048576];
31 main (int argc
, char **argv
)
33 unsigned long long high
= 0, low
= 1;
35 unsigned long long cnt
= strtoull (argv
[1], 0, 0);
37 gettimeofday (&tv
, NULL
);
45 for (j
= 0; j
< (cnt
+ sizeof (buffer
) - 1) / sizeof (buffer
); j
++)
47 for (i
= 0; i
< sizeof (buffer
) / sizeof (buffer
[0]); i
+= 2)
52 if (low
& (1ULL << 63))
55 if (high
& (1ULL << 63))
57 high
= (high
<< 1) | c1
;
61 if (sizeof (buffer
) < cnt
- sizeof (buffer
) * j
)
62 fwrite (buffer
, 1, sizeof (buffer
), stdout
);
64 fwrite (buffer
, 1, cnt
- sizeof (buffer
) * j
, stdout
);