【问题标题】:A/B/n testing, how to distribute web site client?A/B/n测试,如何分发网站客户端?
【发布时间】:2011-02-01 11:45:05
【问题描述】:

在标准的 A/B 测试中,我们可以使用 ip 地址的奇偶校验将客户端分发到 A 或 B 测试页面。

我的问题是当我们需要 3 个案例时如何分配:A/B/C。 如果有人知道编写代码或已经在 c# 中为 asp.net 编写了此代码,我将很高兴知道!

辛恩

【问题讨论】:

    标签: c# asp.net algorithm distribution ab-testing


    【解决方案1】:

    将ip转换成long,然后只做一个模块划分

        switch(addrToNum("ip address")%3)
        {
            case 0:
                break;
            case 1:
                break;
            case 2:
                break;
        }
    

    这里是ip到数字的转换

        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;
        }
    

    【讨论】:

    • @sinner73 这是肯定的。如果您喜欢它,请检查它作为答案,如果可以的话,请点赞。
    猜你喜欢
    • 2018-01-16
    • 1970-01-01
    • 2014-03-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-04-03
    • 2012-11-11
    相关资源
    最近更新 更多