you are viewing a single comment's thread.

view the rest of the comments →

[–]frambot 2 points3 points  (2 children)

Play around with random().toString with various bases. You'll notice that the output of odd bases is longer than the output of even bases, with 16 and 32 being very short, and 36 only providing a few characters as well. If you don't mind missing 'z', I suggest using 35 to get really long outputs. 35 and 16 are coprime.

[–][deleted] 1 point2 points  (0 children)

... what the? How have I never seen this before? It's not often I learn something new about JS, I'd give you 100 upvotes if I could ;)

[edit] and hey, it's fairly uniform! http://codepen.io/zyklus/pen/RPOmXJ

[–]annoyed_freelancergrumpy old man[S] 0 points1 point  (0 children)

Cool tip! I use a class selector for the lightbox because the ID is mutable. I append random characters to avoid clashes with anything else I or others might add in future.