# Why not skip libc for _all_ random functions?

- Thread: https://externals.io/message/30617
- Original archive: https://news-web.php.net/php.internals/30617
- Started by Lars Gunther on 2007-07-08T10:37:46+00:00
- Messages: 1
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · RFCs at https://externals.io/rfc.md · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #30617 — Lars Gunther — 2007-07-08T10:37:46+00:00

URL: https://externals.io/message/30617#30617

Hi all on this list!

My first post here.

This is a suggestion I think would not be too hard to implement:

Skip libc for all random functions. As I see it there is no reason to 
keep it. I can't think of any application that would break if `rand()` 
would produce better random results at a higher speed.

So basically what I am saying is this: Implement the mersenne twister in 
the back of all random functions.

1. Make `rand()` an alias to `mt_rand()`
2. Make `srand()` an alias to `mt_srand()`
3. Make `getrandmax()` an alias to `mt_getrandmax()`
4. Have `array_rand()` implement MT in the back (if it is not doing so 
already)

However, I am not a C-coder. I can not help out in this task myself, but 
thinks it makes sense and could be quite easy to do - for someone that 
do knows how to C.


Lars Gunther

P.S. For an introduction to who I am one might read:
http://www.webstandards.org/action/edutf/interviews/gunther-en/
and look at
http://www.flickr.com/photos/keryxgunther/143376264/
