A/B/n testing, how to distribute web site client?
-
27-10-2019 - |
Question
In standard A/B testing, we can use the parity of the ip adresse to distribute the client to A or B testing page.
My question is how to distribute when we need 3 case: A/B/C. If someone know to code or has already coded this for asp.net in c#, I will be happy to know !
Sinn'
Solution
Convert the ip to long, and then just make a module divide
switch(addrToNum("ip address")%3)
{
case 0:
break;
case 1:
break;
case 2:
break;
}
and here is the convertion of the ip to number
public long addrToNum(IPAddress Address)
{
byte[] b = BitConverter.GetBytes(Address.Address);
if (b.Length == 8)
return (long)(((long)16777216 * b[0]) + ((long)(65536 * b[1])) + ((long)(256 * b[2])) + b[3]);
else
return 0;
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow