- A user first fills in some text fields, eg: name, email, phone.
- Then he is shown 15 items (1,2,3,... 15).
- Because we don't want number 1 be always in the beginning, we add some variance on the display order.
- The display order for this user (or for this session) will be reused later.
- Because of 4), we may either
a) randomize the order once, then cache it, or
b) calculate the order from some info of this user (or this session). - For b), I am thinking to generate a hash from the text field inputs,
then convert the hash to display order. - The conversion does not need to be evenly distributed, that is,
the probability of occurrence of each of the 15! (= 1.3e+12) permutations does not need to be equal.
M = number of items
P(1) = {1,2,3,...,M}
P(2) = {2,1,3,...,M}
P(m) = some permutationh = hash( name, email, phone ), or hash( session id ), just a hash from some text
N(h) = an integer in the range [ 1, M ]then the order we want = P(N(h))
Question: what is the good way to this conversion?