You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Tim Bray <Ti...@Sun.COM> on 2008/10/03 02:06:12 UTC

random functions tutorial?

I stupidly used random() and srandom() in my module to generate  
"random" filenames at high volume and, well, sigh.  Anyhow, the page  
at http://apr.apache.org/docs/apr/1.3/group__apr__random.html lacks  
tutorial value.  Anyone written up the *right* way to use these?  -T

Re: random functions tutorial?

Posted by Tim Bray <Ti...@Sun.COM>.
On Oct 2, 2008, at 8:11 PM, Paul Querna wrote:

> Tim Bray wrote:
>> I stupidly used random() and srandom() in my module to generate  
>> "random" filenames at high volume and, well, sigh.  Anyhow, the  
>> page at http://apr.apache.org/docs/apr/1.3/group__apr__random.html  
>> lacks tutorial value.  Anyone written up the *right* way to use  
>> these?  -T
>
> Ignore all of them except apr_generate_random_bytes.

Exactly what I needed to know.  Thank you.   -Tim

Re: random functions tutorial?

Posted by Paul Querna <ch...@force-elite.com>.
Tim Bray wrote:
> I stupidly used random() and srandom() in my module to generate "random" 
> filenames at high volume and, well, sigh.  Anyhow, the page at 
> http://apr.apache.org/docs/apr/1.3/group__apr__random.html lacks 
> tutorial value.  Anyone written up the *right* way to use these?  -T

Ignore all of them except apr_generate_random_bytes.

For making temp files, also consider apr_file_mktemp, with or without 
the APR_DELONCLOSE.