Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top


When you press "save" they generate uid for your jsfiddle like vzBZB.

How do they do it? Why only 5 characters?

And first of all - How do they make sure there's never a collision? (same uid generated for 2 different jsfiddles)

Can they run out of UIDs some day?

share|improve this question

closed as off topic by slhck, Simon Sheehan, 8088, Sathya Dec 14 '11 at 7:15

Questions on Super User are expected to relate to computer software or computer hardware within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

well if it is just letters and it is case sensitive that would give you 3.8E8 IDs. To put that into perspective, they could give out a new ID every second for 12 years – EBGreen Dec 13 '11 at 20:43
As for avoiding collisions, I have no idea what that service is, but in theory they could just hand them out sequentially. – EBGreen Dec 13 '11 at 20:44
up vote 1 down vote accepted

How do they do it? Why only 5 characters?

The only sure way to know is ask jsFiddle, so this part of your question is not really constructive.

The UIDs are not generates sequentially, which is probably to prevent someone from browsing thorugh everybody else's fiddles.

How do they make sure there's never a collision?

That part is simple: You can just generate one at random and check if it does not exists already.

If it doesn't, you are done. If it does, repeat.

As long as there at least as much unused UIDs as used ones, you don't have to repeat more than once most times.

Can they run out of UIDs some day?

With a 52 letter alphabet (A-Z and a-z), you have 52 ^ 5 = 380,204,032 different UIDs available.

That already is a lot of fiddles, but if they ever run out, they could just add a sixth letter.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged .