Welcome Guest, Not a member yet? Register   Sign In
How to create random, but unique IDs?
#16

[eluser]mddd[/eluser]
If you have 100 000 id's out of a pool of 100 million, one in 1000 is used. That won't be a big problem in getting new id's just by trying. I think building a list upfront is more work than it pays off. You'll have to try a few times on maximum to get a new id. No problem there I would say. You're not making id's all the time - otherwise you would be over 100 000. So I'd just try a new random id and try again if it already exists.

That said, I think you are in an in-between situation here. Do you need to have id's that can't easily be guessed? Then you should have longer id's. Does it not really matter? Then why not just use incrementing numbers.

I mean, if some kind of security depends on people not guessing id's, I would not want to be in this database. Guessing a number is pretty easy if there are 100 000 (or even just 10 000) items in a pool of 100 M.


Messages In This Thread
How to create random, but unique IDs? - by El Forum - 05-12-2010, 12:14 PM
How to create random, but unique IDs? - by El Forum - 05-12-2010, 12:34 PM
How to create random, but unique IDs? - by El Forum - 05-12-2010, 01:10 PM
How to create random, but unique IDs? - by El Forum - 05-12-2010, 01:14 PM
How to create random, but unique IDs? - by El Forum - 05-12-2010, 01:34 PM
How to create random, but unique IDs? - by El Forum - 05-12-2010, 01:38 PM
How to create random, but unique IDs? - by El Forum - 05-12-2010, 01:55 PM
How to create random, but unique IDs? - by El Forum - 05-12-2010, 01:59 PM
How to create random, but unique IDs? - by El Forum - 05-12-2010, 02:24 PM
How to create random, but unique IDs? - by El Forum - 05-12-2010, 02:53 PM
How to create random, but unique IDs? - by El Forum - 05-13-2010, 06:49 AM
How to create random, but unique IDs? - by El Forum - 05-13-2010, 01:26 PM
How to create random, but unique IDs? - by El Forum - 05-13-2010, 01:51 PM
How to create random, but unique IDs? - by El Forum - 05-13-2010, 02:45 PM
How to create random, but unique IDs? - by El Forum - 05-13-2010, 07:03 PM
How to create random, but unique IDs? - by El Forum - 05-14-2010, 12:36 AM



Theme © iAndrew 2016 - Forum software by © MyBB