Can random numbers be predicted based on microtime?
I ask this because I want to create a session id where the first part is based on microtime.
And the rest is filled up with random characters.
This way I'm 100% shore that never a same session id can be created.
Can random numbers be predicted based on microtime?
Moderator: General Moderators
- WaldoMonster
- Forum Contributor
- Posts: 225
- Joined: Mon Apr 19, 2004 6:19 pm
- Contact:
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
Given the same algorithm use on all results, yes.
Why not use the built-in creation?
So long as the ID is uniform in length there is always the chance of a collision with a previous value. The chances grow smaller and smaller as the permutations grow. However, if it is flawed, mathematically your collision chances go up quickly as does the ability to guess ID's.
Why not use the built-in creation?
So long as the ID is uniform in length there is always the chance of a collision with a previous value. The chances grow smaller and smaller as the permutations grow. However, if it is flawed, mathematically your collision chances go up quickly as does the ability to guess ID's.
- WaldoMonster
- Forum Contributor
- Posts: 225
- Joined: Mon Apr 19, 2004 6:19 pm
- Contact:
Ok.feyd wrote:Given the same algorithm use on all results, yes.
I use a database/cookie session, so that I need to create my own id.feyd wrote:Why not use the built-in creation?
Or did you mean uniqid?
Thanks for the info.feyd wrote:So long as the ID is uniform in length there is always the chance of a collision with a previous value. The chances grow smaller and smaller as the permutations grow. However, if it is flawed, mathematically your collision chances go up quickly as does the ability to guess ID's.
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
Building your own session manager does not require you to create your own session ID's.
Take a look here: session_set_save_handler()
Take a look here: session_set_save_handler()