Originally Posted by
pt123
Thanks Loke,
yabbadabbadont then you can create 2+ lists, depending on how you have kept your wallpapers.
Or you can create 2 random numbers
eg. random1x 3 + (RANDOM2 % 3)
will handle 32,000 X 3 wallpapers.
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.
In case anyone wants it, here is my getrandom.c code:
Code:
#include <time.h>
#include <stdlib.h>
#include <stdio.h>
/*
** 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])) + 1);
}
else
{
printf("%ld", j);
}
return 0;
}
Bookmarks