I'm really a newbie to C programming, don't know jack about style, convention,
etc. So I'd like comments on a little app I recently wrote.

It is called randomit.c

It is supposed to generate random integers in a certain range specified by two
endpoints inclusive. i.e.: randomit 10 100 will send to stdout a random long int
between 10 and 100. should work for negative numbers too.

My code is included. Please give me some comments!

One usefull thing you can do with it is grab a random file from a list (i.e.
directory listing): (using bash's $() instead of ``)

/bin/ls -1 | head -$(randomit 1 $(/bin/ls -1 | wc -l) ) | tail -1

My program does give an error on the printf saying it can't print long ints, or
something, why is that? (it converts my longs to ints, how do I do a format
statement for longs in printf?)

Brock


-- 
/---------------------------/-------------------------------------------------\
| R. Brock Lynn           /  http://www.geocities.com/ResearchTriangle/3328/  |
| [EMAIL PROTECTED]   /        Linux: The Choice of a GNU Generation!       |
\---------------------/-------------------------------------------------------/

randomit-0.01.tar.gz

Reply via email to