I just wrote a tiny C program to generate them. It works well with my randomizing and rotating scripts. Besides, I think that your method won't work. I'm not positive, but I think that all numeric variables are limited to 32K in bash. Don't quote me on that though.
Originally Posted by pt123
In case anyone wants it, here is my getrandom.c code:
** With no parameter, just print the
** results of calling random() to stdout.
** With a parameter, limit the maximum
** value printed to that parameter.
int main(int argc, char *argv)
int i = 0;
long int j = 0;
** Seed the PRNG with the current time.
srandom((unsigned int) time((time_t *) NULL));
** PRNG's generally return better results
** after they have been hit a few thousand
** times. My needs aren't that strict, so
** I'll just hit it a thousand times. ;)
for (i = 0; i < 1000; i++)
j = random();
** Are we limiting the value?
if (argc == 2)
printf("%ld", (j % atol(argv)) + 1);