Hi,

> I need to run a script, perhaps using FBSD's 'rand' or 'random' command (or
> any other) that will generate one single 5-digit number 'at random' between
> 00001-99999
> 
> Anyone have thoughts on how to do this....??

Don't know about a shell way to do this, but what about this tiny
C program (compile and link with gcc -c -o r.o && gcc -or r.o)

#include <stdlib.h>
#include <time.h>
 
int main (int argc, char *argv[]) {
        srandomdev();
        /* use this on non-BSD systems:
        srandom(time (0));
        */
        
        unsigned int r = random () % 99999 +1;
        printf ("%d\n", r);
        
        return r;
}

Cheers,
 Simon
_______________________________________________
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to