Collision probability with random number plus timestamp as a username -


say need generate random username user. first set random number generated using function. in next case set username random number + timestamp. case has more probability of collision ? decidable ?

edit please note not generating usernames used people. placeholder.

and importantly i'm not appending timestamp. i'm rather performing addition.

to further elaborate, take random number 105 , timestamp 106. username 211. later timestamp bigger number there still probability during timestamp 201 generated random number might 10, making 211 again.

obviously, more characters have, less have collision. chance of collision 1/(#ofcharsinusername ^ #ofpossiblecharacters supported). example, 5 character password using lowercase alphabet have 1/(5^26) chance of collision. since appending timestamp username hard have collision occur. see 3 potential issues however. first need make sure use time fed random function, or have same username multiple times. second if use time fed random number generator if generate 2 usernames @ same time same (even if append time end). last 1 if append timestamp end of username going quite annoying people entering username, timestamps have bunch of colons , other garbage associated them. prompt different solution, producing mix of letters , numbers. different solution might grab set amount of random numbers , use ascii values concatenate username. going 21 126 give of lower , upper case letters, along numbers , symbols. in addition make difficult have collision because wouldn't execute in time password. likelyhood of collision 1/(n^105) n number of characters.


Comments

Popular posts from this blog

IF statement in MySQL trigger -

c++ - What does MSC in "// appease MSC" comments mean? -

javascript - Blogger related post gadget image Resize s72-c [ Need Expert Help ] -