代码改变世界

带上下限的红包算法实践总结

2017-03-03 14:01  hduhans  阅读(2310)  评论(1编辑  收藏  举报

  最近项目开发中遇到一个随机红包需求,与微信红包不同的是,我们项目需要设置随机上下限范围,避免每位用户分配到的红包差距过大,从而导致大多用户的抱怨。

一、需求分析与实现-带上下限对称随机红包算法

  网上有很多关于微信红包的实现算法,笔者也特意请教了一位曾经参与红包算法的大牛,最早期的微信红包算法完全是按照同一随机种子来随机分配红包,这是完完全全的随机算法。PS:计算机的所有随机都是依赖随机种子,相同的随机种子随机结果具有可再现性。

/**
 * 获取指定随机种子的前n个随机结果
 * 此时只要随机种子seed固定,则返回列表的前n个随机结果也是固定的,每份红包可以按随机比例分配
 * @param n
 * @param seed
 * @return
 */
private static List<Float> getRandomList(int n, long seed) {
    Random random  = new Random(seed);
    List<Float> randomList = new ArrayList<>();
    for (int i = 0; i < n; i++) {
        randomList.add(random.nextFloat());
    }
    return randomList;
} 
View Code

  与此不同的是,我们项目中要求每份红包在一定范围内波动,分配第n个红包依赖于前n-1个红包的分配结果,详细分析如下(金币代表红包):

  假设总金币数量为S1,总份数为P1,已发币量为S2,已发份数为P2,则平均值为S1/P1,则随机下限SMIN=(S1/P1)*0.1,随机上限SMAX=(S1/P1)*1.9。设生成的第n个随机币值为X,剩余获取总值为Y,则剩余币S1-S2=X+Y,当Y取最大值时X取最小值,当Y取最小值时X取最大值,同时X应处于限定随机上下限(SMIN~SMAX)之间,得出X的随机范围为:MAX(S1–S2-(P1–P2-1)*SMAX,SMIN)<=X<=MIN(S1–S2–(P1–P2-1)*SMIN,SMAX),分析示意图如图1:

 图1 第n个随机币分配范围公式

  得出公式,程序实现就很简单了,使用java实现的分配算法如下:

/**
 * 返回min~max区间内随机数,含min和max
 * @param min
 * @param max
 * @return
 */
private static int getRandomVal(int min, int max) {
    Random random = new Random();
    return random.nextInt(max - min + 1) + min;
}

/**
 * 随机分配第n个红包
 * @param totalBonus 总红包量
 * @param totalNum 总份数
 * @param sendedBonus 已发送红包量
 * @param sendedNum 已发送份数
 * @param rdMin 随机下限
 * @param rdMax 随机上限
 * @return
 */
private static Integer randomBonusWithSpecifyBound(Integer totalBonus, Integer totalNum, Integer sendedBonus,
        Integer sendedNum, Integer rdMin, Integer rdMax) {
    Integer boundMin = Math.max((totalBonus - sendedBonus - (totalNum - sendedNum - 1) * rdMax), rdMin);
    Integer boundMax = Math.min((totalBonus - sendedBonus - (totalNum - sendedNum - 1) * rdMin), rdMax);
    return getRandomVal(boundMin, boundMax);
}

/**
 * 生成红包一次分配结果
 * @param totalBonus 总红包量
 * @param totalNum 总份数
 * @return
 */
public static List<Integer> createBonusList(Integer totalBonus, Integer totalNum) {
    Integer sendedBonus = 0;
    Integer sendedNum = 0;
    Integer rdMin = (int) (totalBonus / totalNum * 0.1);
    Integer rdMax = (int) (totalBonus / totalNum * 1.9);
    List<Integer> bonusList = new ArrayList<>();
    while (sendedNum < totalNum) {
        Integer bonus = randomBonusWithSpecifyBound(totalBonus, totalNum, sendedBonus, sendedNum, rdMin, rdMax);
        bonusList.add(bonus);
        sendedNum++;
        sendedBonus += bonus;
    }
    return bonusList;
}
View Code
二、升级版-带上下限非对称随机红包算法

  以上算法合理运行的前提是随机范围是对称的,SMIN~SMAX的平均值为期望的平均值,此时S1/P2=(SMIN+SMAX)/2。需求方希望在稳定的玩法上增加少许刺激,即允许让少数用户拿到较多数量的金币,此时S1/P2<(SMIN+SMAX)/2。此时使用上述算法仍然可以运行,每一份仍然可以分配到SMIN~SMAX之间的金币数量,并且总金币数能刚好被分完。

  改造下方法createBonusList,动态传入rdMin和rdMax:

/**
 * 生成红包一次分配结果
 * @param totalBonus 总红包量
 * @param totalNum 总份数
 * @return
 */
public static List<Integer> createBonusList(Integer totalBonus, Integer totalNum, Integer rdMin, Integer rdMax) {
    Integer sendedBonus = 0;
    Integer sendedNum = 0;
    List<Integer> bonusList = new ArrayList<>();
    while (sendedNum < totalNum) {
        Integer bonus = randomBonusWithSpecifyBound(totalBonus, totalNum, sendedBonus, sendedNum, rdMin, rdMax);
        bonusList.add(bonus);
        sendedNum++;
        sendedBonus += bonus;
    }
    return bonusList;
} 
View Code

  改造后,我们来运行一次,设置总金币数为5000,总份数为50,随机下限为50,随机上限为400,测试运行100次createBonusList(5000, 50, 50, 400),结果如下:

第1次随机:[66, 386, 327, 101, 106, 284, 107, 353, 77, 323, 119, 237, 349, 146, 186, 111, 66, 56, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第2次随机:[314, 362, 386, 349, 349, 262, 356, 96, 158, 266, 129, 68, 53, 50, 52, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第3次随机:[302, 384, 207, 72, 210, 362, 397, 143, 265, 283, 314, 72, 59, 115, 64, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第4次随机:[349, 218, 253, 128, 252, 208, 380, 266, 273, 376, 117, 83, 154, 143, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第5次随机:[274, 238, 335, 224, 279, 282, 57, 336, 261, 69, 163, 86, 138, 389, 94, 57, 57, 56, 51, 52, 50, 52, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第6次随机:[308, 104, 282, 272, 157, 76, 382, 343, 133, 95, 261, 299, 219, 256, 55, 50, 53, 54, 50, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第7次随机:[128, 171, 99, 226, 129, 347, 111, 390, 293, 286, 65, 75, 308, 174, 53, 241, 223, 53, 72, 56, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第8次随机:[180, 171, 105, 243, 66, 364, 193, 216, 308, 205, 132, 201, 325, 234, 67, 89, 243, 58, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第9次随机:[306, 72, 195, 175, 276, 142, 106, 391, 299, 204, 345, 89, 222, 115, 234, 106, 63, 60, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第10次随机:[279, 259, 365, 140, 148, 137, 124, 249, 359, 358, 128, 242, 207, 127, 88, 59, 62, 60, 53, 52, 53, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第11次随机:[198, 377, 118, 220, 265, 224, 218, 341, 113, 151, 189, 373, 56, 263, 78, 54, 63, 70, 58, 68, 50, 51, 51, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第12次随机:[288, 197, 210, 159, 247, 93, 322, 275, 351, 333, 151, 52, 257, 207, 63, 92, 50, 53, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第13次随机:[99, 284, 398, 186, 307, 111, 51, 67, 399, 360, 374, 122, 230, 56, 97, 121, 85, 50, 50, 53, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第14次随机:[260, 62, 270, 177, 285, 300, 198, 99, 326, 242, 351, 205, 51, 324, 96, 54, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第15次随机:[352, 357, 105, 177, 367, 133, 331, 112, 74, 200, 80, 74, 140, 348, 223, 64, 89, 113, 55, 64, 81, 53, 54, 53, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第16次随机:[92, 310, 258, 97, 121, 103, 72, 237, 113, 88, 94, 133, 64, 214, 231, 298, 353, 121, 138, 277, 97, 51, 83, 50, 50, 52, 53, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第17次随机:[225, 380, 219, 336, 67, 261, 330, 368, 291, 282, 165, 104, 52, 61, 56, 83, 58, 53, 51, 56, 51, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第18次随机:[203, 153, 314, 254, 377, 131, 114, 398, 84, 297, 204, 233, 255, 149, 70, 62, 51, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第19次随机:[281, 126, 177, 187, 54, 346, 115, 351, 79, 57, 90, 145, 369, 354, 160, 395, 51, 62, 50, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第20次随机:[330, 363, 71, 212, 165, 177, 98, 357, 178, 152, 127, 400, 189, 286, 62, 62, 81, 64, 72, 51, 51, 50, 51, 50, 50, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第21次随机:[54, 215, 225, 252, 368, 242, 196, 321, 196, 222, 267, 143, 164, 334, 50, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第22次随机:[238, 184, 366, 182, 61, 222, 197, 221, 360, 224, 303, 277, 265, 51, 59, 88, 52, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第23次随机:[299, 76, 151, 325, 263, 329, 228, 67, 313, 90, 316, 161, 168, 194, 124, 144, 57, 90, 53, 51, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第24次随机:[237, 211, 374, 60, 113, 62, 204, 110, 110, 213, 174, 165, 293, 166, 317, 213, 117, 116, 132, 70, 60, 57, 54, 58, 53, 55, 52, 51, 53, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第25次随机:[52, 316, 287, 222, 211, 71, 52, 306, 306, 342, 236, 304, 57, 96, 66, 316, 106, 54, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第26次随机:[256, 138, 358, 175, 344, 175, 77, 80, 330, 273, 133, 53, 134, 329, 167, 93, 59, 208, 64, 52, 51, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第27次随机:[305, 198, 58, 101, 146, 59, 215, 157, 389, 364, 254, 350, 108, 346, 123, 122, 53, 50, 50, 52, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第28次随机:[81, 160, 210, 271, 191, 255, 127, 289, 254, 384, 315, 187, 82, 147, 290, 56, 50, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第29次随机:[236, 309, 273, 261, 254, 237, 350, 175, 333, 314, 300, 52, 52, 53, 50, 50, 50, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第30次随机:[61, 270, 382, 350, 50, 219, 323, 213, 177, 118, 197, 109, 253, 151, 147, 117, 187, 67, 54, 51, 51, 51, 52, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第31次随机:[265, 135, 57, 61, 336, 261, 336, 149, 122, 82, 104, 224, 346, 337, 259, 126, 102, 97, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第32次随机:[250, 306, 383, 179, 395, 337, 224, 188, 93, 359, 319, 50, 61, 51, 51, 51, 51, 52, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第33次随机:[122, 384, 344, 210, 107, 355, 263, 173, 273, 311, 174, 352, 71, 59, 50, 52, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第34次随机:[117, 163, 161, 313, 159, 248, 256, 138, 147, 214, 347, 382, 300, 165, 70, 50, 98, 64, 58, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第35次随机:[254, 197, 304, 398, 141, 70, 118, 188, 360, 86, 333, 118, 336, 175, 117, 98, 53, 54, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第36次随机:[287, 242, 184, 204, 237, 291, 77, 318, 131, 279, 323, 290, 71, 132, 166, 54, 63, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第37次随机:[174, 343, 397, 361, 225, 53, 328, 237, 210, 79, 198, 186, 201, 75, 154, 72, 54, 53, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第38次随机:[372, 109, 197, 339, 389, 262, 209, 397, 238, 242, 147, 106, 109, 52, 68, 56, 50, 53, 54, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第39次随机:[51, 123, 156, 224, 160, 253, 228, 178, 266, 392, 156, 329, 248, 283, 186, 52, 52, 57, 54, 50, 50, 52, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第40次随机:[165, 367, 330, 163, 215, 242, 356, 147, 363, 228, 218, 225, 58, 111, 55, 54, 51, 50, 51, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第41次随机:[107, 171, 236, 68, 298, 311, 74, 254, 127, 281, 206, 256, 327, 352, 65, 96, 94, 65, 58, 51, 53, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第42次随机:[62, 349, 253, 203, 130, 318, 357, 152, 131, 351, 185, 95, 374, 214, 65, 60, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第43次随机:[259, 257, 162, 288, 126, 93, 109, 124, 353, 99, 170, 59, 341, 232, 132, 234, 97, 234, 56, 59, 62, 52, 51, 50, 50, 50, 50, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第44次随机:[266, 86, 392, 335, 101, 257, 367, 299, 119, 366, 204, 178, 93, 108, 70, 50, 51, 50, 50, 54, 53, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第45次随机:[193, 186, 350, 278, 299, 217, 239, 260, 399, 309, 267, 70, 52, 65, 60, 54, 50, 50, 50, 50, 52, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第46次随机:[282, 245, 130, 108, 360, 230, 144, 54, 95, 284, 334, 305, 67, 133, 81, 357, 108, 70, 62, 50, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第47次随机:[316, 259, 234, 190, 220, 262, 138, 59, 226, 185, 349, 148, 268, 289, 54, 51, 79, 61, 53, 59, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第48次随机:[178, 55, 216, 373, 208, 272, 388, 277, 144, 383, 387, 121, 114, 58, 75, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第49次随机:[130, 85, 309, 278, 163, 390, 195, 238, 238, 111, 398, 250, 293, 76, 68, 72, 56, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第50次随机:[175, 269, 106, 167, 347, 390, 384, 211, 156, 289, 135, 152, 62, 219, 82, 143, 61, 52, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第51次随机:[341, 214, 316, 310, 185, 274, 206, 363, 290, 352, 120, 70, 68, 72, 50, 67, 51, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第52次随机:[308, 148, 268, 240, 260, 395, 240, 295, 337, 244, 92, 79, 228, 50, 50, 51, 55, 55, 53, 51, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第53次随机:[155, 282, 366, 159, 204, 271, 187, 383, 210, 61, 227, 176, 329, 127, 99, 54, 53, 53, 50, 52, 51, 50, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第54次随机:[323, 114, 291, 161, 176, 309, 159, 397, 241, 98, 253, 399, 152, 73, 61, 58, 79, 56, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第55次随机:[159, 159, 109, 108, 145, 128, 237, 279, 356, 374, 64, 270, 92, 337, 393, 79, 59, 50, 52, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第56次随机:[86, 327, 286, 302, 162, 141, 200, 165, 159, 374, 280, 270, 109, 338, 50, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第57次随机:[223, 71, 72, 92, 123, 139, 306, 349, 254, 290, 194, 263, 293, 326, 239, 60, 54, 52, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第58次随机:[304, 210, 74, 102, 170, 67, 333, 184, 229, 164, 89, 94, 370, 101, 394, 208, 133, 143, 54, 55, 69, 52, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第59次随机:[309, 163, 128, 319, 220, 161, 300, 253, 220, 209, 305, 129, 365, 56, 65, 82, 66, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第60次随机:[325, 177, 106, 356, 259, 267, 59, 232, 279, 237, 57, 271, 80, 349, 191, 54, 50, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第61次随机:[180, 354, 383, 83, 250, 84, 238, 241, 190, 396, 328, 257, 92, 101, 70, 53, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第62次随机:[259, 212, 205, 322, 351, 100, 393, 311, 92, 254, 234, 252, 67, 108, 76, 53, 57, 50, 50, 50, 54, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第63次随机:[71, 216, 203, 200, 237, 294, 51, 228, 278, 159, 314, 157, 375, 257, 91, 127, 88, 50, 54, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第64次随机:[243, 75, 121, 143, 103, 296, 124, 197, 126, 363, 186, 159, 342, 380, 334, 95, 61, 51, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第65次随机:[380, 155, 63, 346, 246, 158, 207, 128, 287, 248, 287, 80, 286, 192, 104, 69, 83, 51, 54, 52, 73, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第66次随机:[393, 355, 169, 152, 183, 212, 383, 270, 185, 197, 141, 71, 341, 72, 97, 77, 51, 50, 50, 50, 50, 50, 50, 50, 50, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第67次随机:[291, 64, 271, 198, 345, 267, 223, 384, 285, 64, 172, 223, 230, 155, 52, 62, 55, 56, 50, 50, 52, 50, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第68次随机:[72, 387, 219, 274, 229, 342, 158, 294, 72, 384, 147, 89, 297, 135, 136, 56, 53, 50, 54, 52, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第69次随机:[228, 371, 332, 194, 137, 147, 172, 319, 320, 261, 191, 398, 60, 70, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第70次随机:[344, 98, 232, 151, 161, 186, 283, 223, 315, 346, 318, 325, 143, 50, 50, 52, 55, 65, 52, 50, 50, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第71次随机:[76, 235, 382, 179, 104, 318, 265, 56, 162, 352, 365, 254, 71, 132, 179, 64, 127, 69, 51, 58, 50, 50, 50, 50, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第72次随机:[197, 396, 152, 206, 300, 255, 159, 319, 359, 195, 336, 78, 69, 95, 113, 63, 54, 53, 50, 50, 50, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第73次随机:[90, 259, 50, 171, 99, 173, 251, 202, 108, 328, 87, 351, 246, 246, 152, 166, 125, 249, 61, 68, 54, 52, 52, 60, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第74次随机:[315, 304, 91, 122, 327, 80, 373, 354, 130, 76, 201, 282, 293, 181, 109, 50, 52, 58, 50, 50, 50, 52, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第75次随机:[320, 182, 366, 226, 268, 52, 193, 129, 51, 399, 211, 206, 284, 91, 103, 194, 58, 61, 52, 53, 50, 50, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第76次随机:[317, 180, 70, 365, 143, 326, 155, 228, 150, 97, 174, 263, 377, 203, 182, 58, 57, 53, 52, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第77次随机:[83, 59, 73, 384, 55, 250, 149, 57, 280, 320, 113, 118, 316, 336, 323, 129, 144, 69, 85, 127, 54, 56, 60, 59, 50, 50, 50, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第78次随机:[109, 355, 353, 75, 63, 140, 380, 104, 86, 381, 174, 269, 110, 173, 226, 290, 55, 52, 50, 52, 53, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第79次随机:[189, 214, 160, 104, 111, 108, 319, 252, 132, 370, 237, 275, 266, 299, 195, 66, 52, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第80次随机:[86, 384, 316, 290, 129, 234, 299, 223, 151, 189, 68, 294, 114, 86, 257, 72, 142, 66, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第81次随机:[352, 197, 358, 222, 178, 120, 215, 390, 229, 330, 114, 169, 77, 200, 86, 62, 50, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第82次随机:[161, 76, 124, 103, 239, 362, 158, 97, 276, 267, 358, 92, 386, 329, 135, 66, 63, 96, 57, 51, 50, 50, 50, 54, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第83次随机:[161, 229, 234, 227, 289, 207, 227, 196, 302, 300, 82, 310, 59, 171, 91, 94, 65, 53, 91, 55, 80, 72, 52, 51, 52, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第84次随机:[58, 138, 140, 320, 318, 354, 317, 100, 173, 292, 209, 229, 269, 170, 130, 73, 51, 51, 51, 52, 52, 52, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第85次随机:[167, 270, 358, 340, 96, 193, 370, 67, 345, 356, 68, 209, 181, 139, 67, 70, 51, 53, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第86次随机:[323, 171, 345, 312, 92, 367, 124, 312, 114, 112, 266, 318, 58, 261, 68, 57, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第87次随机:[217, 272, 179, 299, 234, 105, 325, 139, 51, 60, 375, 286, 123, 341, 69, 172, 103, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第88次随机:[369, 306, 373, 175, 144, 208, 77, 224, 93, 191, 152, 77, 231, 283, 117, 110, 170, 77, 59, 50, 57, 57, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第89次随机:[161, 148, 139, 363, 162, 318, 84, 306, 88, 177, 66, 180, 212, 240, 103, 280, 99, 97, 87, 155, 60, 69, 52, 53, 50, 50, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第90次随机:[276, 100, 372, 124, 52, 297, 290, 240, 199, 273, 324, 312, 106, 55, 197, 56, 63, 62, 50, 52, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第91次随机:[300, 99, 324, 355, 213, 305, 277, 347, 60, 300, 309, 54, 59, 168, 70, 59, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第92次随机:[94, 179, 222, 167, 336, 148, 363, 279, 341, 267, 297, 380, 61, 56, 59, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第93次随机:[214, 50, 58, 361, 82, 168, 180, 93, 133, 99, 141, 146, 138, 142, 89, 294, 258, 117, 157, 295, 320, 58, 53, 54, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第94次随机:[246, 198, 171, 398, 121, 153, 392, 70, 150, 344, 232, 327, 106, 97, 173, 93, 65, 51, 51, 55, 50, 55, 52, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第95次随机:[391, 205, 237, 290, 362, 383, 147, 278, 114, 60, 359, 137, 107, 54, 64, 108, 51, 51, 51, 50, 50, 50, 50, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第96次随机:[134, 335, 255, 333, 96, 237, 397, 343, 232, 386, 253, 51, 50, 54, 89, 53, 52, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第97次随机:[332, 63, 375, 352, 342, 73, 394, 215, 203, 114, 110, 124, 398, 102, 53, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第98次随机:[139, 199, 52, 122, 201, 305, 117, 369, 207, 87, 81, 375, 166, 128, 136, 182, 131, 163, 120, 71, 61, 146, 52, 64, 59, 67, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第99次随机:[297, 311, 175, 188, 65, 67, 388, 79, 230, 282, 164, 361, 153, 292, 143, 104, 50, 50, 50, 50, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第100次随机:[272, 332, 310, 121, 219, 281, 296, 100, 243, 352, 93, 67, 260, 199, 84, 50, 60, 61, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
最小值50平均出现次数:30
View Code

  可以发现,前几份领到的金币数量较大,导致队列后相当部分份数的金币数量为随机最小值,此时虽然整个分配算法数值上是符合要求的,但是体验上确是非常差的,需要对算法进行改造。

  出现此现象的原因是,随机范围50~400的平均值为225,前几次分配时将金币领的差不多了,后面分配的金币只能领取最小值。我们需要对会引起分配失衡的范围150~400进行概率限制,其出现次数越多,分配失衡问题越严重。此时随机范围分布示意图如图2(SMAX'为SMIN相对平均值AVG的对称点):

图2 非对称随机范围分布点示意图

  假设d2>d1,设置SMIN~SMAX出现的概率r=d1/(d1+d2),设置剩下的概率1-r在SMIN~SMAX'中随机。r随与d2距离成反比,与d1距离成正比。当d2越大时,SMIN~SMAX出现的概率越小,避免出现严重的失衡问题。使用java实现的升级版非对称随机红包分配算法如下:

/**
 * 返回一次抽奖在指定中奖概率下是否中奖
 * @param rate 中奖概率
 * @return
 */
public static boolean canReward(double rate) {
    return Math.random() <= rate;
}

/**
 * 返回min~max区间内随机数,含min和max
 * @param min
 * @param max
 * @return
 */
private static int getRandomVal(int min, int max) {
    Random random = new Random();
    return random.nextInt(max - min + 1) + min;
}

/**
 * 随机分配第n个红包
 * @param totalBonus 总红包量
 * @param totalNum 总份数
 * @param sendedBonus 已发送红包量
 * @param sendedNum 已发送份数
 * @param rdMin 随机下限
 * @param rdMax 随机上限
 * @return
 */
private static Integer randomBonusWithSpecifyBound(Integer totalBonus, Integer totalNum, Integer sendedBonus,
        Integer sendedNum, Integer rdMin, Integer rdMax) {
    Integer avg = totalBonus / totalNum;
    Integer leftLen = avg - rdMin;
    Integer rightLen = rdMax - avg;
    Integer boundMin = 0, boundMax = 0;
    if (leftLen.equals(rightLen)) {
        boundMin = Math.max((totalBonus - sendedBonus - (totalNum - sendedNum - 1) * rdMax), rdMin);
        boundMax = Math.min((totalBonus - sendedBonus - (totalNum - sendedNum - 1) * rdMin), rdMax);
    } else if (rightLen.compareTo(leftLen) > 0) {
        // 上限偏离
        double bigRate = leftLen / (double)(leftLen + rightLen);
        Integer standardRdMax = avg + leftLen;  // 右侧对称上限点
        Integer _rdMax = canReward(bigRate) ? rdMax : standardRdMax;
        boundMin = Math.max((totalBonus - sendedBonus - (totalNum - sendedNum - 1) * standardRdMax), rdMin);
        boundMax = Math.min((totalBonus - sendedBonus - (totalNum - sendedNum - 1) * rdMin), _rdMax);
    } else {
        // 下限偏离
        double smallRate = rightLen / (double)(leftLen + rightLen);
        Integer standardRdMin = avg - rightLen;  // 左侧对称下限点
        Integer _rdMin = canReward(smallRate) ? rdMin : standardRdMin;
        boundMin = Math.max((totalBonus - sendedBonus - (totalNum - sendedNum - 1) * rdMax), _rdMin);
        boundMax = Math.min((totalBonus - sendedBonus - (totalNum - sendedNum - 1) * standardRdMin), rdMax);
    } 
    return getRandomVal(boundMin, boundMax);
}

/**
 * 生成红包一次分配结果
 * @param totalBonus 总红包量
 * @param totalNum 总份数
 * @return
 */
public static List<Integer> createBonusList(Integer totalBonus, Integer totalNum, Integer rdMin, Integer rdMax) {
    Integer sendedBonus = 0;
    Integer sendedNum = 0;
    List<Integer> bonusList = new ArrayList<>();
    while (sendedNum < totalNum) {
        Integer bonus = randomBonusWithSpecifyBound(totalBonus, totalNum, sendedBonus, sendedNum, rdMin, rdMax);
        bonusList.add(bonus);
        sendedNum++;
        sendedBonus += bonus;
    }
    return bonusList;
}
View Code

  同样测试运行100次createBonusList(5000, 50, 50, 400),结果如下:

第1次随机:[111, 123, 94, 289, 82, 250, 56, 84, 141, 100, 127, 139, 56, 75, 271, 114, 300, 261, 143, 87, 71, 89, 149, 117, 121, 109, 95, 108, 77, 55, 114, 78, 64, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第2次随机:[82, 73, 50, 126, 145, 50, 65, 73, 67, 74, 144, 98, 99, 137, 98, 135, 55, 131, 144, 102, 96, 140, 81, 103, 130, 133, 185, 103, 95, 101, 58, 95, 67, 142, 133, 92, 90, 70, 62, 74, 360, 86, 97, 67, 130, 60, 51, 50, 51, 50]
第3次随机:[81, 132, 98, 119, 196, 135, 52, 59, 62, 379, 103, 94, 125, 86, 157, 110, 55, 103, 78, 144, 222, 123, 89, 97, 145, 122, 68, 54, 97, 132, 122, 138, 106, 119, 141, 72, 92, 73, 60, 55, 55, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第4次随机:[226, 68, 74, 88, 239, 87, 76, 132, 122, 58, 114, 122, 75, 129, 101, 55, 116, 141, 138, 206, 75, 58, 216, 60, 92, 77, 129, 78, 62, 66, 134, 108, 104, 147, 242, 139, 153, 58, 81, 54, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第5次随机:[113, 276, 119, 141, 84, 113, 70, 141, 92, 72, 126, 125, 130, 79, 54, 68, 150, 118, 80, 63, 79, 98, 98, 102, 138, 68, 60, 114, 87, 77, 85, 127, 134, 88, 67, 127, 121, 113, 122, 100, 110, 117, 141, 67, 60, 59, 72, 54, 51, 50]
第6次随机:[67, 99, 352, 99, 259, 88, 143, 102, 140, 117, 69, 67, 149, 105, 122, 148, 61, 144, 72, 146, 328, 106, 75, 84, 289, 125, 105, 79, 107, 67, 77, 102, 54, 50, 53, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第7次随机:[193, 59, 72, 119, 71, 85, 311, 140, 142, 77, 62, 99, 109, 60, 295, 133, 312, 107, 93, 92, 95, 138, 132, 72, 150, 133, 70, 53, 66, 90, 134, 102, 107, 96, 135, 52, 76, 57, 50, 54, 57, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第8次随机:[79, 54, 113, 119, 109, 134, 76, 139, 150, 331, 113, 138, 144, 56, 57, 95, 101, 119, 87, 84, 114, 135, 59, 257, 125, 80, 149, 85, 78, 80, 327, 51, 126, 140, 73, 72, 66, 60, 69, 55, 50, 50, 51, 50, 50, 50, 50, 50, 50, 50]
第9次随机:[310, 80, 103, 95, 115, 142, 124, 244, 148, 96, 91, 75, 86, 63, 188, 148, 112, 104, 148, 110, 55, 99, 67, 138, 121, 91, 95, 143, 117, 188, 90, 143, 120, 140, 61, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第10次随机:[111, 83, 141, 276, 120, 57, 138, 87, 105, 104, 215, 107, 56, 263, 111, 201, 99, 163, 150, 361, 136, 89, 141, 112, 136, 141, 80, 54, 80, 65, 58, 55, 50, 54, 50, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第11次随机:[108, 104, 139, 94, 63, 314, 79, 79, 74, 122, 90, 56, 57, 116, 85, 62, 143, 50, 63, 54, 357, 126, 87, 115, 104, 96, 79, 80, 80, 98, 79, 132, 142, 155, 56, 106, 55, 109, 90, 90, 90, 189, 103, 129, 50, 51, 50, 50, 50, 50]
第12次随机:[63, 82, 126, 142, 121, 205, 55, 119, 128, 377, 142, 87, 110, 99, 87, 81, 71, 71, 78, 53, 131, 82, 113, 149, 94, 58, 371, 125, 124, 104, 85, 135, 137, 89, 120, 64, 65, 56, 50, 50, 50, 50, 50, 50, 51, 50, 50, 50, 50, 50]
第13次随机:[86, 241, 182, 63, 136, 131, 378, 126, 148, 95, 74, 91, 59, 94, 112, 86, 63, 100, 139, 148, 118, 146, 126, 202, 111, 136, 126, 146, 114, 61, 123, 58, 58, 65, 70, 83, 50, 54, 50, 50, 50, 51, 50, 50, 50, 50, 50, 50, 50, 50]
第14次随机:[115, 144, 61, 128, 90, 87, 331, 140, 65, 130, 56, 308, 132, 64, 128, 113, 54, 71, 133, 140, 125, 63, 82, 96, 80, 54, 55, 99, 109, 58, 137, 97, 100, 54, 64, 150, 91, 53, 142, 148, 148, 105, 50, 50, 50, 50, 50, 50, 50, 50]
第15次随机:[71, 91, 146, 137, 89, 378, 64, 135, 67, 121, 79, 67, 136, 100, 136, 62, 124, 106, 141, 142, 106, 72, 106, 260, 63, 54, 100, 107, 108, 84, 78, 99, 185, 240, 96, 52, 143, 55, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第16次随机:[147, 54, 121, 103, 109, 115, 84, 88, 66, 71, 150, 99, 96, 119, 60, 52, 226, 89, 115, 248, 88, 124, 135, 185, 148, 60, 73, 74, 81, 86, 58, 119, 137, 112, 128, 149, 123, 102, 119, 127, 95, 65, 50, 50, 50, 50, 50, 50, 50, 50]
第17次随机:[91, 66, 82, 125, 70, 310, 51, 60, 116, 55, 61, 79, 53, 111, 103, 74, 144, 138, 110, 123, 253, 96, 56, 157, 328, 64, 137, 99, 106, 148, 85, 397, 137, 102, 62, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第18次随机:[130, 143, 146, 99, 144, 85, 125, 86, 87, 54, 183, 79, 325, 188, 242, 79, 100, 75, 333, 146, 102, 82, 54, 139, 123, 301, 50, 73, 73, 82, 86, 76, 60, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第19次随机:[55, 207, 175, 148, 361, 146, 131, 176, 128, 113, 83, 71, 77, 60, 146, 141, 88, 67, 139, 105, 101, 171, 81, 107, 135, 127, 132, 125, 96, 151, 123, 133, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第20次随机:[88, 139, 132, 125, 80, 149, 94, 92, 60, 111, 94, 342, 83, 95, 90, 61, 80, 83, 117, 116, 132, 140, 53, 122, 97, 145, 90, 97, 70, 78, 87, 65, 79, 60, 134, 100, 76, 116, 80, 55, 142, 121, 101, 109, 82, 64, 88, 84, 50, 52]
第21次随机:[146, 51, 61, 144, 105, 108, 77, 91, 103, 146, 70, 121, 116, 114, 93, 70, 100, 341, 94, 224, 93, 78, 55, 85, 78, 147, 130, 70, 89, 88, 146, 96, 246, 82, 68, 93, 142, 184, 58, 93, 53, 50, 50, 50, 50, 51, 50, 50, 50, 50]
第22次随机:[139, 70, 238, 102, 147, 131, 109, 215, 110, 145, 94, 59, 52, 82, 111, 66, 106, 108, 89, 94, 67, 137, 149, 102, 115, 56, 145, 76, 81, 80, 398, 92, 120, 65, 147, 143, 72, 57, 70, 61, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第23次随机:[123, 124, 109, 52, 59, 115, 120, 356, 353, 96, 126, 90, 105, 122, 236, 84, 95, 143, 71, 365, 224, 146, 65, 85, 76, 72, 55, 65, 94, 54, 93, 66, 55, 72, 66, 58, 55, 52, 50, 50, 50, 52, 51, 50, 50, 50, 50, 50, 50, 50]
第24次随机:[379, 146, 97, 73, 69, 127, 67, 106, 142, 53, 124, 118, 122, 364, 115, 94, 55, 162, 119, 125, 50, 82, 62, 120, 151, 140, 126, 55, 139, 82, 245, 139, 100, 51, 50, 50, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第25次随机:[82, 132, 126, 68, 142, 127, 75, 83, 55, 129, 133, 82, 134, 87, 97, 298, 99, 84, 75, 117, 374, 103, 120, 77, 113, 110, 290, 114, 132, 122, 196, 92, 75, 54, 50, 50, 51, 51, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第26次随机:[60, 100, 75, 65, 69, 150, 108, 132, 109, 199, 329, 115, 71, 138, 51, 54, 292, 69, 136, 80, 139, 82, 90, 140, 93, 72, 115, 124, 123, 61, 130, 52, 71, 249, 72, 94, 138, 51, 61, 93, 58, 77, 52, 55, 50, 54, 51, 51, 50, 50]
第27次随机:[53, 132, 55, 192, 218, 160, 126, 129, 120, 93, 55, 53, 127, 122, 57, 134, 148, 147, 105, 296, 71, 81, 391, 67, 140, 82, 69, 143, 55, 235, 150, 74, 59, 58, 52, 50, 50, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第28次随机:[66, 148, 122, 123, 342, 53, 109, 127, 116, 126, 85, 148, 89, 88, 80, 131, 126, 132, 107, 201, 95, 200, 50, 324, 275, 68, 222, 138, 50, 52, 53, 53, 50, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第29次随机:[136, 85, 125, 81, 96, 140, 97, 50, 206, 144, 95, 79, 129, 59, 84, 120, 147, 95, 102, 120, 143, 57, 52, 146, 139, 147, 87, 83, 305, 64, 392, 61, 129, 66, 147, 76, 52, 62, 51, 50, 50, 50, 51, 50, 50, 50, 50, 50, 50, 50]
第30次随机:[163, 105, 123, 71, 94, 78, 66, 126, 133, 95, 87, 51, 56, 121, 150, 91, 100, 220, 135, 130, 138, 56, 68, 52, 125, 64, 287, 94, 63, 143, 100, 59, 61, 134, 97, 399, 138, 108, 64, 51, 50, 50, 54, 50, 50, 50, 50, 50, 50, 50]
第31次随机:[218, 84, 52, 105, 74, 91, 331, 105, 52, 131, 93, 120, 100, 148, 63, 92, 76, 80, 116, 119, 219, 129, 125, 158, 90, 82, 123, 380, 131, 137, 118, 131, 77, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第32次随机:[134, 246, 133, 112, 58, 89, 62, 83, 53, 92, 96, 113, 56, 108, 104, 78, 139, 133, 56, 81, 147, 67, 94, 99, 113, 131, 67, 53, 53, 157, 51, 73, 130, 133, 58, 92, 118, 50, 91, 125, 72, 109, 104, 72, 127, 119, 105, 99, 126, 139]
第33次随机:[123, 95, 68, 144, 107, 127, 137, 114, 121, 77, 150, 59, 68, 144, 81, 87, 130, 85, 144, 116, 115, 139, 55, 372, 192, 108, 226, 101, 128, 88, 228, 114, 79, 68, 51, 55, 50, 50, 52, 50, 51, 51, 50, 50, 50, 50, 50, 50, 50, 50]
第34次随机:[72, 59, 54, 61, 377, 90, 351, 114, 105, 295, 136, 64, 64, 75, 193, 66, 60, 68, 115, 90, 261, 86, 53, 88, 57, 84, 73, 151, 124, 143, 113, 85, 83, 59, 81, 142, 141, 61, 52, 54, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第35次随机:[105, 135, 78, 63, 87, 50, 130, 146, 54, 134, 149, 177, 213, 85, 129, 152, 148, 113, 66, 64, 136, 314, 325, 240, 183, 142, 86, 123, 94, 58, 55, 50, 64, 52, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第36次随机:[77, 349, 379, 120, 116, 95, 52, 136, 83, 138, 130, 75, 109, 54, 149, 312, 100, 133, 84, 81, 122, 352, 125, 118, 106, 135, 76, 94, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第37次随机:[92, 143, 150, 74, 57, 125, 141, 50, 78, 71, 147, 76, 73, 113, 81, 71, 125, 108, 73, 124, 120, 104, 144, 133, 132, 85, 126, 78, 118, 84, 104, 359, 145, 231, 50, 110, 117, 111, 52, 57, 118, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第38次随机:[52, 80, 144, 99, 82, 78, 83, 68, 259, 68, 78, 141, 64, 92, 134, 129, 53, 89, 72, 73, 138, 114, 126, 128, 127, 73, 379, 135, 131, 74, 67, 77, 106, 115, 380, 69, 113, 106, 50, 51, 51, 51, 51, 50, 50, 50, 50, 50, 50, 50]
第39次随机:[105, 91, 146, 87, 119, 50, 168, 51, 91, 171, 137, 71, 272, 102, 51, 90, 130, 107, 71, 123, 165, 74, 123, 79, 103, 114, 114, 131, 96, 113, 114, 316, 87, 144, 113, 110, 95, 56, 62, 51, 51, 54, 51, 51, 50, 50, 50, 50, 50, 50]
第40次随机:[93, 103, 137, 132, 116, 135, 113, 117, 100, 201, 117, 67, 61, 140, 80, 137, 67, 260, 70, 147, 94, 62, 149, 148, 131, 68, 124, 121, 57, 72, 135, 143, 58, 61, 58, 68, 262, 62, 130, 72, 53, 52, 62, 55, 58, 50, 51, 50, 51, 50]
第41次随机:[98, 92, 136, 150, 79, 97, 83, 57, 83, 106, 71, 113, 137, 133, 59, 117, 128, 93, 101, 128, 274, 146, 108, 344, 65, 50, 119, 92, 114, 132, 94, 129, 125, 125, 148, 88, 93, 55, 76, 50, 51, 59, 50, 52, 50, 50, 50, 50, 50, 50]
第42次随机:[125, 94, 63, 70, 98, 144, 114, 126, 162, 52, 73, 220, 120, 94, 61, 81, 131, 97, 69, 79, 95, 140, 76, 113, 80, 122, 82, 113, 144, 113, 124, 115, 64, 106, 67, 122, 57, 127, 87, 111, 145, 79, 94, 100, 169, 53, 55, 72, 52, 50]
第43次随机:[115, 145, 109, 61, 74, 128, 67, 65, 84, 276, 69, 65, 145, 130, 135, 118, 124, 98, 57, 50, 143, 54, 66, 52, 83, 95, 85, 143, 83, 91, 200, 55, 101, 87, 102, 54, 78, 52, 149, 73, 106, 70, 114, 129, 253, 138, 65, 57, 57, 50]
第44次随机:[66, 123, 89, 54, 147, 51, 89, 147, 97, 77, 105, 110, 138, 146, 50, 123, 237, 108, 78, 93, 56, 101, 118, 96, 76, 80, 93, 104, 77, 88, 71, 50, 93, 98, 131, 128, 92, 115, 136, 95, 123, 72, 102, 109, 114, 143, 98, 85, 59, 69]
第45次随机:[83, 58, 132, 338, 140, 136, 147, 78, 128, 96, 181, 82, 109, 96, 100, 93, 88, 109, 101, 179, 66, 355, 354, 105, 68, 115, 129, 126, 68, 102, 53, 73, 55, 53, 52, 52, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第46次随机:[55, 90, 60, 147, 138, 93, 251, 136, 76, 110, 124, 71, 74, 77, 146, 97, 90, 54, 104, 107, 133, 88, 51, 91, 121, 147, 69, 137, 103, 98, 67, 336, 132, 318, 128, 66, 51, 108, 80, 58, 65, 52, 51, 50, 50, 50, 50, 50, 50, 50]
第47次随机:[54, 60, 150, 129, 101, 131, 145, 127, 131, 65, 116, 127, 53, 115, 143, 122, 160, 151, 51, 100, 69, 84, 114, 51, 119, 149, 93, 125, 118, 58, 300, 132, 93, 146, 60, 76, 64, 86, 143, 53, 50, 93, 78, 90, 61, 51, 51, 58, 53, 51]
第48次随机:[119, 125, 141, 125, 71, 101, 138, 118, 53, 97, 160, 90, 148, 103, 64, 326, 87, 86, 121, 50, 86, 364, 124, 112, 117, 72, 218, 135, 147, 52, 155, 129, 115, 50, 50, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第49次随机:[73, 130, 109, 104, 311, 61, 141, 58, 121, 53, 105, 80, 81, 96, 81, 90, 116, 90, 110, 73, 356, 95, 128, 67, 132, 58, 137, 103, 129, 66, 94, 109, 103, 52, 251, 57, 73, 80, 88, 54, 142, 97, 91, 54, 51, 50, 50, 50, 50, 50]
第50次随机:[62, 70, 105, 50, 54, 109, 141, 96, 58, 116, 136, 124, 140, 136, 51, 135, 106, 59, 101, 79, 66, 302, 97, 139, 65, 55, 62, 113, 201, 149, 63, 88, 301, 54, 270, 99, 59, 147, 105, 120, 67, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第51次随机:[255, 96, 77, 124, 116, 85, 60, 97, 124, 77, 73, 112, 144, 98, 85, 134, 341, 105, 112, 77, 109, 387, 55, 252, 108, 82, 50, 72, 90, 141, 110, 131, 58, 109, 66, 84, 52, 52, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第52次随机:[149, 52, 149, 94, 52, 342, 139, 83, 88, 139, 83, 119, 77, 98, 146, 107, 74, 145, 149, 64, 108, 146, 69, 141, 65, 104, 109, 52, 62, 133, 89, 111, 59, 73, 148, 141, 111, 141, 135, 121, 69, 55, 54, 55, 50, 50, 50, 50, 50, 50]
第53次随机:[213, 139, 79, 113, 89, 52, 55, 86, 365, 121, 55, 102, 134, 176, 145, 105, 133, 90, 109, 110, 116, 109, 106, 103, 169, 103, 61, 100, 122, 136, 147, 136, 90, 129, 65, 119, 57, 52, 52, 55, 51, 51, 50, 50, 50, 50, 50, 50, 50, 50]
第54次随机:[114, 133, 104, 282, 82, 85, 128, 144, 256, 135, 103, 140, 79, 213, 51, 56, 105, 105, 119, 93, 147, 76, 102, 115, 113, 131, 103, 63, 119, 314, 65, 211, 57, 57, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第55次随机:[61, 79, 121, 94, 128, 140, 95, 88, 55, 92, 91, 82, 144, 104, 296, 92, 243, 75, 88, 70, 125, 93, 91, 71, 97, 63, 96, 119, 66, 139, 71, 113, 379, 90, 83, 103, 117, 88, 142, 56, 68, 64, 59, 69, 50, 50, 50, 50, 50, 50]
第56次随机:[73, 137, 132, 90, 136, 147, 141, 145, 138, 88, 93, 62, 102, 123, 61, 145, 71, 130, 293, 89, 86, 355, 167, 82, 130, 64, 69, 182, 111, 113, 99, 89, 77, 118, 101, 61, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第57次随机:[291, 56, 63, 130, 108, 139, 129, 100, 115, 68, 92, 68, 61, 61, 106, 268, 147, 59, 106, 364, 132, 83, 85, 53, 112, 69, 104, 65, 70, 130, 314, 140, 56, 118, 133, 69, 81, 53, 51, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第58次随机:[94, 173, 72, 79, 103, 114, 50, 131, 86, 79, 134, 111, 72, 135, 98, 64, 140, 61, 61, 51, 62, 61, 146, 287, 104, 53, 96, 148, 90, 126, 143, 52, 131, 344, 120, 99, 78, 116, 109, 173, 61, 73, 70, 50, 50, 50, 50, 50, 50, 50]
第59次随机:[81, 81, 142, 90, 69, 139, 64, 150, 197, 129, 205, 79, 99, 84, 83, 150, 96, 89, 88, 55, 135, 94, 85, 54, 140, 62, 358, 89, 140, 62, 127, 103, 73, 146, 114, 98, 121, 68, 125, 55, 69, 83, 67, 58, 50, 52, 50, 51, 51, 50]
第60次随机:[109, 150, 97, 68, 117, 170, 65, 88, 382, 78, 98, 87, 72, 60, 106, 90, 56, 69, 62, 144, 118, 348, 136, 136, 67, 115, 78, 115, 91, 104, 66, 121, 99, 129, 93, 68, 106, 124, 107, 79, 63, 69, 50, 50, 50, 50, 50, 50, 50, 50]
第61次随机:[112, 54, 75, 135, 127, 89, 58, 78, 122, 53, 82, 64, 123, 96, 139, 143, 51, 77, 50, 104, 122, 103, 121, 160, 59, 101, 137, 106, 113, 140, 328, 117, 144, 100, 80, 104, 121, 80, 82, 127, 75, 149, 106, 92, 50, 51, 50, 50, 50, 50]
第62次随机:[64, 125, 348, 97, 121, 61, 70, 95, 56, 142, 56, 122, 73, 135, 144, 150, 53, 85, 77, 141, 84, 94, 148, 98, 54, 75, 308, 133, 127, 123, 69, 130, 59, 107, 93, 86, 222, 148, 53, 62, 57, 50, 53, 50, 50, 52, 50, 50, 50, 50]
第63次随机:[127, 55, 94, 103, 134, 74, 64, 144, 277, 121, 66, 382, 96, 89, 120, 66, 50, 133, 122, 141, 123, 71, 57, 137, 103, 128, 107, 99, 73, 52, 58, 87, 63, 52, 101, 125, 371, 57, 63, 83, 72, 59, 50, 50, 50, 50, 50, 50, 50, 51]
第64次随机:[183, 96, 57, 133, 67, 131, 83, 52, 117, 59, 112, 81, 117, 123, 103, 124, 129, 144, 84, 80, 57, 72, 121, 147, 71, 107, 115, 70, 95, 110, 83, 94, 122, 97, 118, 52, 72, 205, 64, 69, 91, 139, 181, 128, 153, 68, 51, 71, 51, 51]
第65次随机:[102, 70, 123, 357, 81, 86, 108, 85, 141, 71, 92, 125, 131, 129, 101, 60, 129, 131, 118, 106, 134, 87, 265, 73, 121, 97, 141, 150, 104, 88, 129, 67, 118, 69, 85, 135, 75, 88, 76, 50, 50, 51, 50, 51, 50, 50, 50, 50, 50, 50]
第66次随机:[109, 125, 148, 89, 94, 121, 62, 138, 164, 105, 86, 89, 97, 77, 136, 83, 104, 67, 75, 172, 146, 98, 78, 82, 147, 126, 119, 150, 99, 94, 89, 56, 126, 143, 58, 50, 107, 140, 108, 101, 125, 127, 126, 52, 57, 55, 50, 50, 50, 50]
第67次随机:[96, 326, 212, 84, 63, 82, 106, 59, 60, 141, 115, 66, 147, 132, 120, 85, 65, 122, 65, 74, 125, 125, 125, 102, 87, 85, 144, 135, 78, 122, 116, 346, 243, 70, 92, 60, 70, 54, 50, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第68次随机:[61, 53, 128, 60, 116, 127, 94, 99, 84, 240, 107, 69, 62, 86, 145, 117, 50, 107, 145, 107, 89, 104, 169, 78, 146, 348, 123, 67, 89, 68, 54, 70, 141, 94, 84, 127, 113, 145, 103, 125, 110, 70, 69, 57, 50, 50, 50, 50, 50, 50]
第69次随机:[83, 163, 67, 66, 80, 66, 119, 81, 135, 54, 75, 116, 100, 85, 61, 55, 112, 135, 222, 135, 61, 132, 93, 90, 77, 79, 270, 88, 75, 356, 134, 68, 88, 117, 108, 105, 102, 109, 149, 67, 84, 107, 74, 55, 50, 51, 51, 50, 50, 50]
第70次随机:[262, 96, 66, 215, 123, 137, 50, 111, 257, 166, 102, 286, 61, 58, 157, 138, 128, 141, 54, 144, 131, 87, 134, 150, 72, 130, 113, 68, 106, 144, 100, 57, 66, 63, 51, 67, 55, 52, 52, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第71次随机:[125, 132, 82, 97, 119, 132, 144, 90, 119, 133, 107, 109, 125, 82, 104, 63, 69, 55, 54, 366, 123, 396, 58, 119, 113, 78, 122, 265, 123, 137, 209, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第72次随机:[53, 124, 148, 65, 150, 122, 88, 116, 93, 138, 137, 150, 97, 85, 99, 93, 78, 81, 149, 142, 60, 317, 56, 117, 238, 153, 137, 114, 82, 119, 212, 105, 138, 98, 65, 75, 52, 54, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第73次随机:[104, 67, 131, 138, 127, 75, 355, 155, 141, 111, 135, 145, 89, 85, 140, 147, 150, 170, 65, 71, 66, 59, 135, 97, 137, 73, 120, 73, 147, 128, 120, 135, 58, 68, 190, 65, 61, 52, 55, 58, 51, 51, 50, 50, 50, 50, 50, 50, 50, 50]
第74次随机:[60, 77, 108, 144, 107, 80, 134, 103, 137, 127, 369, 93, 92, 86, 93, 131, 133, 121, 90, 81, 71, 53, 145, 143, 55, 80, 137, 82, 79, 74, 54, 60, 63, 127, 97, 342, 94, 110, 89, 68, 148, 60, 52, 50, 51, 50, 50, 50, 50, 50]
第75次随机:[79, 124, 102, 142, 390, 80, 145, 144, 54, 66, 88, 142, 105, 296, 69, 86, 84, 87, 150, 87, 134, 62, 75, 77, 55, 149, 330, 102, 134, 80, 102, 81, 133, 64, 78, 64, 98, 60, 52, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第76次随机:[75, 288, 52, 145, 84, 119, 275, 132, 109, 111, 276, 50, 112, 141, 110, 119, 99, 85, 143, 98, 128, 128, 125, 318, 76, 65, 81, 115, 83, 170, 70, 78, 70, 57, 58, 55, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第77次随机:[71, 326, 332, 132, 370, 57, 82, 139, 134, 147, 54, 136, 92, 145, 108, 140, 87, 100, 70, 328, 214, 333, 53, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第78次随机:[104, 106, 104, 84, 272, 267, 139, 83, 135, 143, 128, 136, 100, 121, 148, 66, 252, 146, 133, 81, 287, 150, 143, 182, 94, 112, 85, 96, 53, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第79次随机:[148, 54, 135, 88, 57, 138, 58, 70, 111, 96, 98, 132, 147, 87, 126, 71, 98, 99, 84, 141, 91, 139, 71, 97, 128, 138, 152, 121, 95, 111, 135, 399, 100, 63, 182, 106, 79, 89, 96, 64, 51, 55, 50, 50, 50, 50, 50, 50, 50, 50]
第80次随机:[71, 74, 116, 91, 132, 131, 105, 242, 361, 123, 141, 192, 119, 57, 60, 68, 50, 60, 63, 65, 78, 84, 86, 129, 146, 327, 130, 109, 58, 85, 91, 76, 149, 111, 246, 73, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第81次随机:[126, 90, 60, 117, 103, 134, 307, 71, 68, 103, 81, 65, 67, 78, 119, 123, 134, 74, 59, 63, 139, 308, 69, 89, 78, 76, 123, 107, 145, 176, 71, 58, 90, 111, 101, 72, 54, 86, 121, 128, 111, 137, 98, 61, 95, 53, 51, 50, 50, 50]
第82次随机:[135, 281, 386, 93, 378, 301, 116, 79, 58, 115, 337, 139, 138, 67, 69, 117, 54, 342, 98, 99, 105, 71, 70, 51, 50, 50, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第83次随机:[73, 259, 126, 71, 93, 143, 62, 99, 150, 127, 96, 105, 118, 122, 63, 104, 141, 133, 147, 84, 136, 67, 54, 150, 363, 358, 80, 137, 123, 136, 87, 64, 73, 55, 50, 50, 50, 50, 50, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第84次随机:[50, 338, 57, 95, 71, 54, 93, 99, 143, 131, 95, 76, 142, 141, 100, 117, 125, 134, 145, 70, 131, 114, 302, 76, 60, 71, 95, 84, 124, 100, 96, 122, 93, 144, 144, 51, 140, 124, 99, 53, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第85次随机:[77, 84, 73, 69, 77, 122, 60, 114, 93, 72, 149, 121, 146, 102, 141, 100, 137, 141, 95, 54, 113, 71, 114, 355, 105, 100, 150, 141, 143, 247, 104, 58, 89, 62, 139, 90, 138, 50, 144, 58, 51, 50, 50, 50, 50, 51, 50, 50, 50, 50]
第86次随机:[195, 117, 362, 115, 147, 92, 130, 76, 144, 127, 146, 123, 108, 63, 140, 59, 77, 58, 126, 150, 131, 123, 137, 378, 68, 119, 53, 150, 150, 71, 84, 62, 61, 58, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第87次随机:[59, 263, 88, 98, 122, 124, 291, 65, 105, 193, 87, 64, 135, 99, 54, 138, 124, 108, 150, 141, 68, 112, 131, 75, 123, 126, 80, 93, 141, 60, 141, 78, 147, 146, 95, 76, 135, 62, 53, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第88次随机:[145, 253, 100, 96, 127, 97, 83, 79, 99, 150, 108, 64, 110, 61, 131, 115, 91, 126, 135, 251, 120, 71, 78, 62, 73, 81, 81, 70, 106, 142, 65, 84, 101, 52, 107, 54, 104, 140, 82, 146, 112, 89, 116, 56, 57, 54, 96, 65, 56, 59]
第89次随机:[118, 131, 115, 148, 77, 123, 144, 66, 379, 82, 100, 144, 210, 83, 73, 109, 112, 324, 325, 265, 80, 107, 143, 95, 107, 62, 75, 54, 85, 53, 55, 51, 54, 50, 50, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第90次随机:[131, 78, 53, 144, 82, 56, 107, 111, 147, 117, 368, 74, 77, 107, 116, 79, 133, 125, 73, 136, 126, 315, 123, 123, 101, 50, 104, 57, 283, 71, 92, 146, 118, 98, 122, 56, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第91次随机:[146, 60, 104, 130, 122, 104, 57, 102, 70, 132, 92, 118, 115, 86, 140, 139, 105, 140, 105, 53, 58, 343, 82, 109, 67, 50, 71, 106, 138, 148, 242, 106, 160, 105, 140, 221, 74, 50, 51, 55, 51, 52, 50, 50, 50, 51, 50, 50, 50, 50]
第92次随机:[114, 107, 336, 66, 254, 134, 99, 140, 140, 129, 95, 127, 66, 122, 352, 107, 139, 80, 85, 73, 59, 69, 84, 78, 50, 150, 75, 147, 106, 95, 56, 108, 89, 90, 109, 124, 81, 58, 57, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第93次随机:[106, 56, 111, 116, 85, 113, 115, 367, 83, 129, 65, 63, 109, 136, 333, 137, 101, 75, 76, 85, 150, 72, 91, 53, 124, 388, 111, 102, 68, 135, 124, 99, 117, 57, 51, 83, 55, 57, 50, 50, 51, 51, 50, 50, 50, 50, 50, 50, 50, 50]
第94次随机:[138, 99, 135, 98, 338, 68, 109, 79, 52, 88, 85, 97, 59, 373, 141, 123, 88, 321, 59, 167, 86, 123, 98, 149, 129, 169, 137, 67, 99, 89, 72, 54, 118, 84, 59, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第95次随机:[140, 120, 99, 92, 69, 107, 145, 140, 137, 133, 93, 125, 74, 76, 145, 55, 95, 89, 72, 87, 54, 105, 146, 140, 52, 138, 116, 323, 90, 94, 146, 126, 106, 127, 77, 240, 128, 85, 59, 51, 52, 52, 50, 50, 50, 50, 50, 50, 50, 50]
第96次随机:[120, 105, 130, 144, 59, 88, 85, 147, 125, 104, 127, 145, 94, 141, 136, 132, 71, 55, 119, 128, 136, 138, 113, 148, 113, 134, 76, 138, 118, 94, 107, 53, 114, 129, 115, 91, 105, 51, 92, 96, 131, 53, 50, 50, 50, 50, 50, 50, 50, 50]
第97次随机:[348, 82, 56, 116, 394, 75, 116, 136, 69, 117, 114, 58, 140, 132, 227, 57, 143, 134, 118, 129, 142, 53, 123, 104, 131, 112, 113, 73, 96, 120, 141, 57, 92, 79, 50, 51, 50, 52, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第98次随机:[121, 98, 56, 99, 174, 295, 106, 113, 372, 67, 72, 115, 124, 73, 119, 222, 142, 88, 116, 107, 150, 105, 62, 50, 95, 84, 145, 100, 84, 104, 121, 134, 106, 50, 128, 69, 55, 69, 52, 56, 50, 51, 50, 50, 50, 50, 51, 50, 50, 50]
第99次随机:[132, 79, 71, 129, 57, 114, 94, 71, 76, 338, 142, 99, 139, 124, 90, 80, 56, 102, 64, 71, 99, 97, 56, 96, 90, 124, 248, 150, 132, 121, 104, 85, 305, 105, 304, 56, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
第100次随机:[94, 123, 82, 63, 227, 74, 145, 79, 90, 51, 53, 113, 217, 120, 346, 150, 330, 124, 72, 137, 77, 53, 311, 113, 66, 139, 148, 87, 119, 166, 63, 51, 57, 52, 52, 54, 50, 52, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
最小值50平均出现次数:10
View Code

  可以发现,相比之前的分配算法,末尾的最小值1出现数量已经大大降低。

三、升级版-带上下限非对称平均值偏移修正随机红包算法

  算法二虽然相比算法一,已经大大降低了对尾最小值出现的次数,但是仍然有一定数目最小值出现在队列末尾,这并不能让人满意。主要原因还是随机范围的不对称导致前面分配的红包平均值越来越大于理想平均值AVG,如果能在每一次红包分配时就尽量考虑将分配后的已发平均值往AVG靠,就能够尽可能减少对尾最小值出现的次数。

  当分配第n份红包时,已发红包平均值currAvg=sendedBonus/sendedNum,期望当前分配值exp=avg-(currAvg-avg)*sendedNum/(totalNum-sendedNum),我们取exp和boundMax的中间值expMid=(exp+boundMax)/2,设置expMid~boundMax出现的概率为y,boundMin~boundMAx出现的概率为1-y,希望本次随机后期望值为exp,即exp=expMid*y+(boundMin+boundMax)/2*(1-y),得出y=(exp-(boundMin+boundMax)/2)/(expMid-(boundMin+boundMax)/2)。

图3 非对称随机范围平均值偏移修正示意图

  使用java实现算法如下:

/**
 * 返回一次抽奖在指定中奖概率下是否中奖
 * @param rate 中奖概率
 * @return
 */
public static boolean canReward(double rate) {
    return Math.random() <= rate;
}

/**
 * 返回min~max区间内随机数,含min和max
 * @param min
 * @param max
 * @return
 */
private static int getRandomVal(int min, int max) {
    Random random = new Random();
    return random.nextInt(max - min + 1) + min;
}

/**
 * 带概率偏向的随机算法,概率偏向subMin~subMax区间
 * 返回boundMin~boundMax区间内随机数(含boundMin和boundMax),同时可以指定子区间subMin~subMax的优先概率
 * 例:传入参数(10, 50, 20, 30, 0.8),则随机结果有80%概率从20~30中随机返回,有20%概率从10~50中随机返回 
 * @param boundMin 边界
 * @param boundMax
 * @param subMin
 * @param subMax
 * @param subRate
 * @return
 */
public static int getRandomValWithSpecifySubRate(int boundMin, int boundMax, int subMin, int subMax, double subRate) {
    if (canReward(subRate)) {
        return getRandomVal(subMin, subMax);
    }
    return getRandomVal(boundMin, boundMax);
}

/**
 * 随机分配第n个红包
 * @param totalBonus 总红包量
 * @param totalNum 总份数
 * @param sendedBonus 已发送红包量
 * @param sendedNum 已发送份数
 * @param rdMin 随机下限
 * @param rdMax 随机上限
 * @return
 */
private static Integer randomBonusWithSpecifyBound(Integer totalBonus, Integer totalNum, Integer sendedBonus,
        Integer sendedNum, Integer rdMin, Integer rdMax) {
    Integer avg = totalBonus / totalNum;  // 平均值
    Integer leftLen = avg - rdMin;  
    Integer rightLen = rdMax - avg;
    Integer boundMin = 0, boundMax = 0;
    
    // 大范围设置小概率
    if (leftLen.equals(rightLen)) {
        boundMin = Math.max((totalBonus - sendedBonus - (totalNum - sendedNum - 1) * rdMax), rdMin);
        boundMax = Math.min((totalBonus - sendedBonus - (totalNum - sendedNum - 1) * rdMin), rdMax);
    } else if (rightLen.compareTo(leftLen) > 0) {
        // 上限偏离
        double bigRate = leftLen / (double)(leftLen + rightLen);
        Integer standardRdMax = avg + leftLen;  // 右侧对称上限点
        Integer _rdMax = canReward(bigRate) ? rdMax : standardRdMax;
        boundMin = Math.max((totalBonus - sendedBonus - (totalNum - sendedNum - 1) * standardRdMax), rdMin);
        boundMax = Math.min((totalBonus - sendedBonus - (totalNum - sendedNum - 1) * rdMin), _rdMax);
    } else {
        // 下限偏离
        double smallRate = rightLen / (double)(leftLen + rightLen);
        Integer standardRdMin = avg - rightLen;  // 左侧对称下限点
        Integer _rdMin = canReward(smallRate) ? rdMin : standardRdMin;
        boundMin = Math.max((totalBonus - sendedBonus - (totalNum - sendedNum - 1) * rdMax), _rdMin);
        boundMax = Math.min((totalBonus - sendedBonus - (totalNum - sendedNum - 1) * standardRdMin), rdMax);
    } 
    
    // 已发平均值偏移修正-动态比例
    if (boundMin.equals(boundMax)) {
        return getRandomVal(boundMin, boundMax);
    }
    double currAvg = sendedNum == 0 ? (double)avg : (sendedBonus / (double)sendedNum);  // 当前已发平均值
    double middle = (boundMin + boundMax) / 2.0;
    Integer subMin = boundMin, subMax = boundMax;
    // 期望值 
    double exp = avg - (currAvg - avg) * sendedNum / (double)(totalNum - sendedNum);
    if (middle > exp) {
        subMax = (int) Math.round((boundMin + exp) / 2.0);
    } else {
        subMin = (int) Math.round((exp + boundMax) / 2.0);
    }
    Integer expBound = (boundMin + boundMax) / 2;
    Integer expSub = (subMin + subMax) / 2;
    double subRate = (exp - expBound) / (double)(expSub - expBound);
    return getRandomValWithSpecifySubRate(boundMin, boundMax, subMin, subMax, subRate);
}


/**
 * 生成红包一次分配结果
 * @param totalBonus 总红包量
 * @param totalNum 总份数
 * @return
 */
public static List<Integer> createBonusList(Integer totalBonus, Integer totalNum, Integer rdMin, Integer rdMax) {
    Integer sendedBonus = 0;
    Integer sendedNum = 0;
    List<Integer> bonusList = new ArrayList<>();
    while (sendedNum < totalNum) {
        Integer bonus = randomBonusWithSpecifyBound(totalBonus, totalNum, sendedBonus, sendedNum, rdMin, rdMax);
        bonusList.add(bonus);
        sendedNum++;
        sendedBonus += bonus;
    }
    return bonusList;
} 
View Code

  同样测试运行100次createBonusList(5000, 50, 50, 400),结果如下:

第1次随机:[138, 99, 56, 107, 107, 77, 118, 93, 51, 140, 69, 55, 61, 88, 111, 141, 128, 56, 113, 107, 126, 85, 108, 144, 141, 110, 60, 142, 89, 79, 323, 53, 132, 61, 112, 113, 149, 54, 83, 50, 67, 89, 51, 103, 97, 119, 149, 75, 54, 67]
第2次随机:[147, 116, 107, 132, 54, 74, 51, 72, 304, 147, 141, 111, 127, 105, 74, 64, 239, 114, 51, 107, 56, 89, 69, 138, 70, 90, 85, 84, 89, 144, 65, 61, 149, 138, 52, 109, 57, 124, 57, 58, 62, 87, 150, 65, 103, 50, 88, 120, 75, 79]
第3次随机:[62, 52, 76, 66, 76, 75, 279, 91, 110, 55, 67, 131, 144, 95, 82, 116, 124, 85, 108, 75, 62, 59, 75, 75, 131, 127, 128, 69, 61, 181, 144, 70, 55, 109, 61, 70, 257, 87, 90, 149, 71, 79, 150, 125, 62, 93, 137, 65, 109, 80]
第4次随机:[76, 75, 70, 71, 134, 92, 71, 140, 140, 62, 68, 57, 69, 69, 88, 94, 80, 219, 89, 107, 93, 142, 135, 73, 108, 142, 147, 129, 140, 110, 141, 85, 62, 110, 67, 133, 115, 106, 130, 137, 128, 64, 85, 76, 54, 61, 129, 95, 80, 52]
第5次随机:[126, 100, 67, 105, 117, 69, 122, 150, 120, 94, 73, 119, 139, 71, 79, 121, 108, 115, 72, 62, 119, 52, 134, 70, 69, 64, 144, 67, 132, 136, 119, 140, 61, 143, 56, 126, 113, 63, 117, 77, 60, 72, 75, 148, 52, 144, 124, 60, 131, 103]
第6次随机:[86, 67, 114, 74, 77, 69, 259, 255, 138, 58, 60, 60, 64, 146, 146, 95, 73, 96, 64, 65, 119, 59, 141, 67, 83, 90, 103, 115, 91, 51, 79, 253, 54, 59, 63, 85, 87, 73, 147, 130, 78, 94, 146, 92, 136, 62, 109, 78, 127, 63]
第7次随机:[107, 126, 62, 63, 80, 142, 75, 78, 127, 102, 85, 59, 113, 108, 143, 90, 145, 150, 70, 138, 52, 66, 59, 95, 125, 116, 149, 132, 86, 72, 144, 104, 60, 109, 61, 67, 54, 148, 141, 123, 129, 58, 60, 143, 138, 82, 93, 74, 53, 144]
第8次随机:[133, 127, 117, 120, 65, 87, 55, 124, 87, 148, 78, 139, 126, 62, 61, 137, 65, 126, 137, 50, 53, 132, 54, 145, 104, 85, 61, 55, 77, 133, 139, 84, 141, 55, 58, 132, 399, 95, 60, 59, 66, 142, 61, 109, 87, 57, 57, 59, 137, 60]
第9次随机:[80, 121, 58, 74, 56, 59, 80, 142, 68, 123, 54, 72, 147, 72, 124, 68, 57, 273, 50, 54, 83, 121, 50, 173, 104, 119, 90, 58, 92, 146, 80, 118, 142, 84, 61, 114, 51, 55, 50, 58, 88, 333, 149, 61, 133, 147, 104, 126, 114, 64]
第10次随机:[58, 300, 59, 74, 116, 66, 70, 99, 107, 120, 97, 146, 90, 123, 56, 113, 71, 74, 127, 52, 114, 125, 117, 85, 129, 51, 132, 138, 68, 86, 135, 95, 56, 64, 56, 85, 91, 125, 106, 133, 148, 144, 69, 140, 119, 56, 115, 95, 54, 51]
第11次随机:[132, 100, 79, 338, 139, 105, 129, 55, 50, 135, 147, 51, 58, 58, 145, 148, 55, 128, 115, 84, 76, 66, 145, 141, 67, 343, 65, 63, 63, 51, 100, 104, 69, 62, 133, 55, 64, 111, 81, 52, 58, 108, 131, 50, 82, 128, 56, 58, 82, 85]
第12次随机:[74, 103, 63, 90, 50, 56, 130, 150, 72, 71, 78, 112, 90, 150, 58, 77, 51, 140, 115, 68, 54, 146, 148, 71, 67, 120, 88, 115, 67, 69, 117, 145, 121, 95, 108, 97, 112, 126, 180, 82, 144, 52, 78, 138, 103, 57, 349, 50, 53, 50]
第13次随机:[71, 66, 104, 137, 122, 110, 92, 103, 82, 72, 104, 148, 67, 91, 115, 75, 66, 137, 139, 106, 50, 51, 83, 53, 118, 65, 92, 83, 145, 108, 75, 55, 58, 147, 128, 120, 135, 131, 128, 67, 135, 141, 118, 242, 52, 150, 58, 75, 66, 64]
第14次随机:[101, 55, 143, 233, 136, 113, 140, 92, 97, 93, 80, 63, 127, 93, 60, 82, 71, 149, 105, 144, 83, 125, 72, 133, 148, 59, 85, 133, 56, 62, 64, 71, 86, 142, 54, 96, 134, 134, 396, 54, 50, 53, 53, 55, 71, 50, 60, 119, 71, 54]
第15次随机:[61, 118, 105, 122, 54, 119, 143, 50, 117, 68, 117, 116, 348, 117, 158, 62, 52, 55, 143, 52, 68, 107, 101, 114, 58, 118, 71, 62, 136, 60, 60, 70, 50, 120, 139, 139, 53, 57, 136, 148, 146, 112, 51, 144, 65, 114, 60, 70, 123, 71]
第16次随机:[79, 98, 59, 60, 99, 68, 93, 128, 77, 141, 51, 88, 134, 85, 115, 116, 93, 154, 140, 60, 127, 61, 104, 145, 121, 132, 61, 50, 125, 50, 131, 126, 58, 138, 142, 111, 101, 114, 53, 98, 56, 133, 57, 83, 117, 91, 144, 206, 76, 51]
第17次随机:[130, 69, 111, 112, 104, 150, 72, 58, 60, 72, 77, 60, 61, 135, 137, 104, 106, 80, 94, 64, 111, 397, 137, 124, 144, 88, 57, 57, 79, 387, 115, 98, 145, 56, 55, 50, 51, 59, 53, 87, 329, 51, 58, 50, 50, 51, 51, 51, 53, 50]
第18次随机:[59, 140, 73, 142, 103, 91, 148, 52, 123, 149, 53, 118, 145, 132, 167, 66, 68, 73, 132, 81, 99, 98, 74, 84, 98, 104, 145, 135, 59, 64, 51, 64, 149, 64, 82, 137, 57, 89, 140, 94, 142, 123, 67, 90, 60, 77, 110, 134, 68, 127]
第19次随机:[64, 136, 135, 111, 98, 71, 117, 62, 54, 148, 57, 133, 58, 80, 123, 97, 141, 139, 70, 64, 55, 66, 62, 135, 58, 50, 138, 64, 63, 122, 141, 83, 80, 133, 118, 149, 107, 147, 150, 62, 53, 81, 71, 78, 142, 145, 63, 149, 128, 149]
第20次随机:[150, 64, 113, 65, 227, 78, 77, 53, 391, 140, 68, 114, 62, 67, 50, 143, 54, 62, 93, 119, 83, 127, 106, 99, 61, 77, 78, 100, 66, 124, 117, 127, 150, 68, 54, 52, 139, 59, 70, 70, 74, 118, 110, 66, 60, 74, 149, 107, 132, 93]
第21次随机:[55, 58, 93, 82, 82, 131, 81, 131, 133, 90, 63, 58, 57, 87, 99, 150, 150, 150, 79, 55, 95, 99, 113, 150, 87, 150, 55, 104, 70, 100, 116, 103, 134, 97, 117, 79, 90, 110, 76, 93, 90, 72, 96, 55, 142, 144, 135, 56, 139, 149]
第22次随机:[95, 136, 66, 135, 67, 74, 140, 84, 135, 99, 60, 111, 59, 135, 112, 132, 73, 70, 63, 69, 56, 127, 67, 51, 130, 84, 270, 114, 100, 80, 136, 83, 142, 112, 149, 55, 144, 123, 51, 55, 69, 137, 143, 137, 125, 52, 71, 52, 65, 105]
第23次随机:[58, 96, 128, 98, 119, 140, 75, 53, 85, 137, 86, 54, 104, 135, 127, 92, 56, 111, 127, 50, 101, 50, 68, 62, 130, 136, 101, 108, 74, 74, 73, 114, 136, 137, 145, 95, 87, 111, 90, 137, 75, 59, 109, 149, 78, 194, 107, 58, 121, 90]
第24次随机:[100, 75, 107, 85, 58, 124, 115, 61, 134, 56, 108, 108, 64, 51, 59, 137, 59, 74, 73, 117, 75, 73, 86, 89, 136, 137, 141, 58, 133, 120, 91, 136, 71, 133, 138, 50, 58, 63, 79, 132, 132, 145, 103, 141, 138, 66, 147, 68, 146, 150]
第25次随机:[76, 98, 93, 127, 73, 63, 66, 126, 94, 107, 138, 59, 92, 104, 111, 130, 131, 83, 76, 74, 101, 133, 73, 106, 186, 57, 125, 98, 70, 144, 55, 81, 117, 94, 60, 143, 113, 82, 121, 58, 97, 74, 67, 146, 108, 82, 106, 146, 133, 103]
第26次随机:[56, 51, 133, 250, 51, 74, 79, 83, 69, 149, 76, 150, 106, 76, 129, 58, 84, 137, 123, 111, 100, 53, 75, 110, 65, 107, 60, 79, 79, 98, 55, 150, 133, 117, 139, 50, 59, 237, 99, 61, 123, 79, 146, 83, 84, 55, 278, 78, 51, 52]
第27次随机:[138, 137, 122, 150, 115, 127, 63, 53, 130, 81, 131, 71, 85, 204, 95, 139, 134, 63, 58, 61, 72, 130, 79, 71, 61, 53, 149, 112, 107, 122, 121, 63, 62, 63, 149, 103, 95, 149, 110, 67, 104, 103, 98, 54, 73, 99, 84, 127, 84, 79]
第28次随机:[106, 56, 132, 52, 74, 72, 145, 61, 75, 106, 116, 98, 139, 90, 120, 111, 106, 72, 71, 75, 117, 356, 97, 73, 137, 91, 59, 149, 60, 69, 98, 144, 73, 153, 56, 52, 111, 262, 64, 66, 54, 373, 51, 51, 57, 50, 50, 50, 50, 50]
第29次随机:[60, 85, 53, 100, 94, 97, 126, 68, 60, 80, 110, 88, 62, 111, 116, 70, 88, 72, 143, 100, 183, 353, 129, 90, 65, 71, 124, 124, 60, 90, 99, 57, 99, 135, 66, 127, 65, 127, 90, 129, 81, 124, 119, 63, 89, 110, 79, 87, 78, 104]
第30次随机:[121, 71, 118, 71, 94, 83, 137, 71, 129, 117, 55, 138, 74, 129, 80, 130, 134, 74, 99, 50, 72, 81, 95, 142, 104, 131, 60, 133, 119, 143, 105, 66, 97, 83, 83, 91, 74, 137, 51, 141, 65, 131, 74, 107, 66, 135, 119, 50, 130, 140]
第31次随机:[61, 387, 55, 147, 118, 58, 134, 70, 114, 80, 89, 51, 102, 113, 148, 102, 71, 55, 71, 63, 71, 59, 143, 60, 105, 112, 78, 61, 137, 120, 95, 76, 52, 135, 103, 88, 68, 143, 96, 68, 67, 58, 133, 123, 112, 71, 85, 150, 97, 145]
第32次随机:[116, 67, 117, 102, 116, 51, 125, 71, 126, 117, 60, 53, 138, 58, 202, 66, 131, 77, 130, 103, 88, 63, 91, 65, 98, 65, 63, 104, 50, 132, 229, 79, 102, 73, 112, 58, 64, 145, 131, 98, 146, 140, 56, 128, 70, 55, 120, 74, 126, 149]
第33次随机:[116, 67, 98, 119, 88, 73, 74, 135, 79, 64, 81, 124, 60, 52, 103, 111, 108, 75, 114, 138, 134, 122, 53, 87, 58, 67, 89, 96, 74, 123, 137, 66, 63, 305, 141, 143, 87, 128, 108, 108, 108, 51, 59, 320, 50, 82, 57, 74, 67, 64]
第34次随机:[102, 60, 273, 149, 62, 112, 63, 128, 68, 122, 67, 95, 52, 100, 223, 53, 79, 129, 73, 150, 62, 135, 50, 65, 59, 114, 64, 61, 51, 70, 53, 87, 142, 114, 120, 103, 136, 80, 85, 141, 95, 69, 113, 130, 71, 135, 63, 137, 110, 125]
第35次随机:[60, 137, 91, 64, 123, 315, 72, 98, 52, 73, 56, 53, 75, 72, 122, 91, 108, 55, 63, 50, 133, 99, 140, 84, 86, 149, 130, 127, 106, 68, 146, 59, 64, 137, 132, 107, 116, 132, 100, 51, 69, 66, 133, 55, 80, 143, 119, 150, 94, 95]
第36次随机:[97, 80, 85, 148, 78, 233, 53, 57, 57, 140, 114, 94, 68, 113, 64, 132, 127, 125, 86, 90, 104, 59, 128, 80, 105, 79, 140, 143, 73, 85, 131, 57, 338, 67, 53, 56, 110, 67, 146, 53, 59, 74, 63, 71, 127, 59, 78, 74, 130, 150]
第37次随机:[71, 60, 140, 100, 61, 121, 102, 101, 65, 115, 76, 61, 61, 59, 133, 52, 139, 129, 52, 66, 53, 394, 111, 54, 115, 60, 102, 70, 55, 58, 80, 135, 114, 52, 52, 146, 136, 140, 130, 64, 146, 123, 101, 121, 304, 56, 55, 57, 50, 102]
第38次随机:[115, 142, 108, 81, 96, 130, 63, 115, 120, 148, 55, 118, 138, 103, 148, 82, 87, 56, 93, 64, 138, 67, 82, 95, 321, 149, 61, 144, 88, 73, 61, 105, 64, 135, 65, 68, 69, 101, 120, 63, 102, 110, 134, 92, 59, 119, 54, 95, 54, 50]
第39次随机:[54, 83, 54, 56, 135, 113, 218, 81, 134, 72, 81, 109, 108, 103, 109, 74, 243, 147, 121, 53, 126, 113, 98, 50, 108, 69, 119, 134, 83, 124, 134, 64, 69, 58, 68, 138, 86, 54, 139, 135, 50, 63, 138, 63, 59, 68, 148, 111, 60, 123]
第40次随机:[64, 63, 123, 68, 137, 63, 119, 146, 63, 137, 52, 85, 135, 58, 238, 80, 82, 116, 51, 89, 115, 121, 127, 57, 87, 59, 71, 53, 86, 74, 91, 121, 70, 141, 62, 106, 224, 73, 140, 135, 81, 140, 144, 56, 79, 139, 126, 125, 78, 50]
第41次随机:[150, 115, 63, 112, 96, 119, 106, 74, 101, 128, 77, 107, 105, 61, 113, 56, 103, 77, 54, 58, 69, 51, 110, 58, 119, 144, 131, 99, 56, 100, 78, 61, 74, 94, 70, 143, 66, 142, 150, 145, 103, 137, 136, 103, 148, 135, 76, 66, 119, 142]
第42次随机:[66, 134, 114, 104, 61, 146, 112, 50, 101, 122, 84, 115, 73, 125, 129, 127, 113, 102, 139, 93, 70, 73, 60, 60, 52, 73, 58, 105, 107, 130, 150, 134, 114, 117, 84, 145, 138, 133, 109, 54, 121, 61, 65, 79, 99, 232, 56, 59, 61, 91]
第43次随机:[114, 63, 83, 78, 137, 65, 150, 81, 70, 134, 72, 71, 141, 140, 108, 70, 68, 91, 84, 102, 66, 97, 111, 130, 97, 71, 66, 58, 60, 146, 146, 139, 119, 63, 141, 117, 74, 104, 100, 87, 86, 137, 78, 77, 119, 369, 51, 50, 67, 52]
第44次随机:[63, 98, 144, 82, 93, 89, 130, 62, 130, 147, 62, 61, 67, 71, 57, 84, 91, 124, 65, 145, 134, 99, 309, 72, 66, 103, 129, 139, 89, 103, 68, 94, 78, 150, 62, 50, 95, 93, 120, 142, 62, 61, 106, 100, 146, 104, 123, 62, 73, 103]
第45次随机:[62, 103, 76, 143, 140, 93, 60, 107, 106, 90, 135, 109, 92, 110, 116, 88, 75, 90, 65, 110, 130, 97, 92, 122, 130, 72, 69, 82, 67, 55, 143, 90, 106, 136, 107, 82, 149, 77, 145, 370, 78, 52, 61, 60, 62, 57, 51, 118, 120, 50]
第46次随机:[131, 84, 72, 115, 64, 53, 57, 110, 140, 143, 106, 59, 65, 112, 57, 126, 104, 117, 90, 58, 56, 137, 99, 73, 64, 50, 118, 140, 117, 143, 85, 149, 79, 57, 142, 57, 100, 147, 144, 142, 78, 124, 92, 113, 83, 117, 140, 106, 127, 58]
第47次随机:[106, 66, 88, 75, 100, 100, 136, 62, 56, 113, 75, 135, 59, 105, 70, 115, 95, 135, 134, 80, 145, 147, 149, 142, 50, 387, 52, 69, 146, 73, 142, 65, 149, 150, 63, 77, 82, 128, 84, 54, 62, 62, 64, 85, 145, 89, 54, 52, 76, 52]
第48次随机:[69, 115, 73, 121, 76, 139, 52, 72, 100, 75, 123, 54, 71, 57, 147, 93, 54, 97, 131, 100, 95, 80, 68, 138, 85, 148, 144, 143, 71, 58, 132, 94, 52, 79, 55, 142, 141, 72, 129, 50, 141, 121, 147, 71, 136, 134, 68, 106, 150, 131]
第49次随机:[283, 88, 73, 101, 85, 141, 106, 133, 68, 108, 94, 105, 79, 54, 81, 68, 126, 81, 119, 62, 52, 124, 128, 139, 123, 73, 90, 101, 97, 90, 70, 57, 66, 127, 137, 95, 107, 103, 111, 109, 63, 69, 76, 52, 135, 120, 70, 150, 160, 51]
第50次随机:[143, 123, 82, 150, 63, 59, 57, 125, 145, 131, 94, 77, 50, 104, 76, 139, 57, 149, 130, 140, 67, 88, 145, 91, 125, 109, 53, 66, 86, 62, 92, 148, 144, 117, 147, 68, 108, 80, 115, 67, 75, 82, 92, 136, 58, 78, 115, 63, 162, 67]
第51次随机:[101, 106, 55, 68, 67, 76, 73, 95, 123, 61, 141, 115, 63, 143, 55, 112, 56, 330, 68, 62, 133, 89, 102, 148, 56, 82, 130, 119, 99, 69, 89, 115, 76, 371, 364, 53, 55, 54, 107, 57, 55, 50, 59, 51, 60, 53, 53, 146, 79, 56]
第52次随机:[98, 114, 149, 64, 91, 77, 140, 93, 83, 138, 116, 98, 146, 64, 109, 72, 150, 120, 140, 111, 98, 59, 116, 86, 396, 72, 52, 89, 81, 55, 50, 57, 63, 107, 85, 126, 52, 81, 144, 157, 64, 54, 51, 56, 105, 106, 63, 143, 106, 53]
第53次随机:[121, 138, 108, 88, 59, 74, 73, 77, 129, 76, 119, 51, 93, 138, 101, 146, 136, 148, 107, 125, 138, 117, 148, 129, 149, 164, 62, 54, 65, 132, 126, 57, 130, 77, 92, 76, 58, 101, 131, 54, 58, 119, 54, 121, 113, 59, 51, 111, 91, 56]
第54次随机:[52, 115, 92, 59, 251, 126, 56, 150, 141, 96, 103, 62, 56, 65, 51, 128, 137, 115, 55, 65, 116, 77, 114, 66, 61, 50, 146, 100, 108, 109, 86, 133, 87, 140, 71, 132, 80, 140, 142, 124, 148, 52, 138, 68, 52, 123, 120, 57, 99, 86]
第55次随机:[100, 144, 97, 77, 148, 57, 110, 138, 69, 52, 113, 106, 132, 58, 50, 66, 96, 104, 135, 140, 77, 68, 73, 84, 119, 77, 77, 129, 90, 143, 90, 101, 112, 74, 107, 67, 124, 127, 124, 71, 71, 121, 147, 59, 69, 146, 142, 167, 71, 81]
第56次随机:[130, 88, 75, 136, 61, 78, 112, 74, 82, 106, 63, 52, 66, 61, 52, 89, 117, 53, 57, 144, 67, 198, 145, 122, 133, 145, 128, 53, 139, 132, 64, 110, 50, 103, 107, 117, 52, 77, 104, 83, 74, 62, 144, 58, 146, 148, 126, 138, 138, 141]
第57次随机:[73, 126, 68, 104, 84, 149, 125, 70, 89, 123, 112, 109, 55, 55, 316, 114, 99, 109, 134, 56, 147, 109, 68, 65, 122, 55, 105, 98, 67, 131, 67, 63, 58, 88, 72, 122, 99, 98, 137, 120, 70, 93, 148, 64, 85, 77, 90, 94, 114, 104]
第58次随机:[59, 56, 147, 98, 70, 150, 121, 87, 104, 145, 57, 82, 129, 66, 65, 105, 147, 64, 137, 119, 68, 68, 101, 96, 113, 56, 51, 144, 58, 58, 119, 131, 137, 128, 108, 140, 138, 72, 146, 92, 115, 137, 119, 59, 54, 58, 52, 148, 82, 144]
第59次随机:[146, 60, 110, 60, 114, 120, 108, 110, 130, 55, 122, 145, 53, 132, 69, 60, 76, 69, 118, 94, 96, 86, 304, 124, 100, 56, 96, 81, 117, 59, 71, 78, 290, 69, 54, 60, 73, 86, 140, 136, 52, 111, 147, 61, 67, 92, 80, 57, 119, 87]
第60次随机:[69, 109, 81, 145, 62, 85, 142, 66, 99, 78, 112, 115, 256, 103, 99, 54, 72, 50, 79, 145, 138, 64, 101, 62, 140, 123, 93, 121, 107, 54, 126, 81, 138, 84, 140, 64, 104, 51, 100, 58, 148, 60, 146, 82, 60, 73, 144, 115, 148, 54]
第61次随机:[112, 86, 94, 134, 66, 358, 86, 70, 93, 75, 137, 72, 115, 124, 136, 54, 103, 51, 75, 83, 86, 146, 67, 79, 97, 63, 70, 73, 56, 56, 84, 73, 71, 105, 303, 144, 142, 67, 146, 50, 58, 99, 67, 67, 170, 57, 149, 62, 111, 58]
第62次随机:[130, 111, 100, 72, 99, 64, 52, 63, 98, 149, 134, 125, 86, 141, 59, 92, 58, 107, 136, 141, 135, 64, 148, 103, 73, 110, 81, 116, 106, 105, 60, 66, 107, 69, 115, 91, 68, 58, 141, 123, 87, 133, 97, 62, 60, 119, 72, 131, 136, 147]
第63次随机:[88, 67, 111, 72, 91, 108, 67, 59, 382, 74, 148, 128, 89, 110, 56, 84, 52, 127, 118, 65, 98, 70, 143, 53, 127, 76, 62, 119, 57, 75, 60, 76, 109, 139, 110, 76, 71, 110, 63, 80, 98, 101, 138, 83, 127, 136, 132, 99, 127, 89]
第64次随机:[56, 123, 60, 113, 51, 105, 119, 94, 105, 90, 66, 79, 131, 105, 52, 84, 67, 130, 78, 125, 53, 148, 67, 95, 62, 64, 128, 112, 75, 143, 71, 141, 117, 83, 96, 129, 59, 51, 115, 140, 104, 146, 84, 143, 145, 55, 146, 106, 139, 150]
第65次随机:[110, 74, 60, 150, 85, 90, 124, 97, 120, 123, 89, 123, 143, 63, 94, 119, 75, 72, 124, 127, 121, 56, 63, 139, 88, 140, 83, 104, 67, 135, 143, 58, 89, 57, 101, 137, 86, 54, 133, 140, 133, 55, 57, 63, 62, 136, 63, 148, 110, 117]
第66次随机:[145, 146, 150, 52, 60, 67, 99, 77, 57, 53, 80, 84, 150, 138, 136, 56, 150, 60, 111, 103, 133, 96, 140, 164, 51, 50, 107, 99, 73, 117, 65, 144, 127, 123, 73, 93, 194, 56, 65, 72, 111, 90, 97, 121, 142, 50, 82, 147, 55, 89]
第67次随机:[115, 137, 128, 74, 122, 101, 108, 100, 136, 74, 102, 105, 74, 137, 115, 107, 64, 54, 125, 90, 122, 68, 75, 120, 68, 149, 85, 120, 146, 71, 118, 68, 52, 147, 58, 64, 68, 118, 117, 75, 132, 134, 105, 123, 123, 55, 65, 82, 103, 101]
第68次随机:[131, 145, 147, 68, 65, 150, 63, 74, 148, 132, 95, 142, 123, 106, 63, 82, 68, 64, 145, 71, 59, 84, 90, 110, 88, 124, 74, 71, 74, 54, 70, 110, 147, 139, 87, 147, 62, 82, 80, 71, 76, 77, 162, 85, 55, 147, 144, 142, 111, 96]
第69次随机:[122, 66, 110, 123, 67, 105, 132, 51, 64, 108, 128, 104, 141, 137, 61, 76, 56, 146, 75, 51, 136, 58, 141, 92, 76, 147, 83, 114, 305, 50, 123, 134, 91, 63, 78, 68, 100, 121, 125, 68, 70, 140, 91, 114, 52, 136, 73, 61, 67, 100]
第70次随机:[79, 50, 62, 119, 64, 73, 118, 107, 92, 102, 52, 138, 259, 102, 148, 79, 115, 139, 105, 89, 103, 97, 70, 132, 88, 114, 68, 50, 59, 135, 66, 83, 73, 137, 85, 135, 136, 112, 70, 135, 99, 98, 59, 118, 86, 121, 90, 90, 59, 140]
第71次随机:[81, 119, 69, 130, 51, 94, 69, 81, 149, 73, 162, 125, 67, 81, 89, 80, 70, 56, 108, 60, 148, 137, 132, 77, 105, 129, 122, 106, 109, 106, 90, 97, 112, 72, 127, 132, 363, 54, 63, 84, 55, 58, 280, 51, 50, 111, 56, 50, 56, 54]
第72次随机:[101, 125, 130, 148, 111, 114, 52, 65, 67, 114, 80, 125, 86, 76, 125, 100, 68, 122, 109, 121, 64, 78, 73, 60, 91, 58, 98, 135, 128, 95, 53, 57, 97, 136, 99, 53, 105, 57, 150, 137, 138, 114, 101, 147, 149, 71, 133, 115, 91, 78]
第73次随机:[140, 148, 116, 50, 86, 52, 148, 65, 72, 53, 52, 66, 138, 91, 146, 116, 116, 126, 133, 74, 68, 142, 57, 113, 129, 67, 67, 142, 109, 140, 105, 141, 62, 112, 72, 139, 119, 129, 58, 52, 105, 130, 57, 71, 71, 143, 142, 141, 60, 69]
第74次随机:[50, 142, 62, 139, 54, 113, 113, 89, 79, 75, 96, 149, 54, 223, 55, 111, 62, 114, 85, 116, 73, 126, 100, 59, 118, 71, 84, 88, 82, 137, 55, 103, 93, 67, 146, 132, 71, 138, 52, 76, 143, 148, 114, 63, 93, 149, 65, 86, 147, 140]
第75次随机:[128, 71, 118, 70, 129, 67, 70, 66, 79, 113, 121, 63, 99, 138, 52, 112, 65, 57, 58, 69, 112, 65, 130, 59, 96, 144, 148, 134, 136, 138, 76, 60, 108, 131, 149, 70, 86, 107, 147, 138, 122, 331, 50, 56, 90, 59, 122, 71, 64, 56]
第76次随机:[63, 59, 127, 137, 99, 74, 66, 136, 63, 64, 144, 100, 140, 113, 131, 112, 143, 50, 122, 143, 114, 122, 59, 66, 97, 59, 102, 71, 72, 96, 100, 146, 117, 67, 200, 150, 106, 76, 133, 150, 60, 57, 55, 65, 117, 88, 150, 70, 67, 82]
第77次随机:[149, 146, 114, 140, 73, 111, 92, 126, 69, 109, 69, 85, 92, 142, 60, 83, 50, 75, 102, 52, 86, 113, 58, 69, 68, 84, 119, 78, 117, 119, 142, 50, 133, 88, 89, 136, 122, 132, 139, 58, 129, 53, 74, 142, 77, 100, 137, 139, 148, 62]
第78次随机:[110, 80, 133, 89, 106, 76, 114, 103, 95, 137, 60, 131, 104, 50, 92, 145, 135, 122, 63, 95, 67, 53, 72, 73, 110, 144, 78, 81, 92, 74, 57, 145, 57, 137, 142, 84, 54, 140, 138, 134, 69, 90, 130, 71, 130, 144, 57, 113, 145, 79]
第79次随机:[82, 74, 91, 109, 165, 129, 51, 63, 83, 71, 92, 69, 126, 125, 66, 56, 143, 74, 65, 72, 147, 291, 148, 69, 136, 109, 100, 83, 78, 147, 59, 190, 64, 132, 59, 71, 131, 66, 92, 121, 119, 66, 63, 59, 59, 98, 54, 130, 103, 150]
第80次随机:[146, 61, 65, 89, 72, 69, 98, 104, 52, 145, 68, 60, 120, 97, 52, 61, 88, 128, 56, 145, 91, 97, 133, 70, 139, 57, 140, 147, 130, 62, 146, 138, 73, 76, 80, 90, 80, 105, 63, 90, 145, 89, 146, 57, 144, 305, 132, 83, 53, 63]
第81次随机:[150, 109, 133, 136, 145, 60, 132, 109, 117, 94, 57, 55, 104, 137, 138, 61, 85, 96, 101, 92, 98, 92, 61, 105, 51, 121, 124, 102, 71, 118, 142, 117, 83, 146, 55, 122, 125, 124, 78, 62, 108, 71, 54, 129, 52, 85, 67, 64, 118, 144]
第82次随机:[132, 130, 142, 94, 117, 56, 73, 67, 115, 100, 56, 174, 60, 70, 137, 126, 90, 126, 98, 107, 111, 64, 150, 79, 64, 120, 123, 134, 262, 59, 86, 116, 52, 103, 51, 57, 97, 53, 84, 54, 142, 98, 70, 77, 96, 128, 130, 88, 120, 62]
第83次随机:[133, 79, 60, 59, 81, 70, 68, 87, 102, 104, 61, 83, 139, 72, 62, 74, 123, 83, 55, 107, 121, 142, 136, 67, 107, 163, 86, 136, 132, 115, 50, 137, 73, 66, 110, 130, 103, 146, 139, 89, 89, 137, 121, 142, 53, 101, 110, 149, 67, 81]
第84次随机:[56, 108, 99, 130, 94, 139, 125, 53, 52, 78, 67, 93, 76, 75, 105, 83, 144, 84, 143, 59, 75, 66, 103, 105, 55, 73, 144, 134, 89, 71, 334, 121, 101, 64, 56, 91, 252, 83, 100, 90, 121, 70, 65, 93, 50, 134, 114, 87, 74, 122]
第85次随机:[136, 89, 140, 146, 275, 64, 148, 80, 131, 50, 55, 50, 52, 56, 149, 88, 55, 146, 53, 79, 109, 133, 134, 66, 86, 56, 71, 84, 138, 69, 138, 81, 128, 113, 71, 100, 139, 138, 66, 96, 147, 61, 53, 78, 83, 131, 64, 135, 93, 97]
第86次随机:[114, 70, 53, 93, 143, 146, 138, 54, 58, 80, 54, 143, 83, 104, 50, 74, 136, 59, 118, 108, 110, 143, 132, 70, 149, 81, 108, 137, 67, 147, 90, 110, 121, 98, 91, 145, 150, 134, 119, 54, 245, 52, 59, 77, 55, 62, 128, 55, 81, 52]
第87次随机:[51, 114, 78, 131, 81, 96, 127, 79, 87, 133, 88, 140, 98, 124, 69, 125, 69, 138, 134, 125, 140, 57, 361, 72, 86, 136, 115, 58, 52, 63, 122, 65, 90, 144, 92, 58, 79, 99, 63, 68, 124, 140, 232, 68, 50, 51, 73, 51, 51, 53]
第88次随机:[80, 86, 147, 55, 111, 108, 137, 56, 137, 74, 55, 115, 143, 62, 142, 135, 130, 56, 136, 50, 66, 50, 124, 120, 120, 52, 97, 98, 64, 116, 91, 143, 125, 281, 131, 69, 51, 75, 108, 70, 59, 82, 65, 123, 80, 91, 146, 110, 94, 84]
第89次随机:[97, 53, 60, 120, 50, 124, 98, 113, 121, 60, 67, 120, 67, 65, 149, 150, 55, 107, 118, 145, 144, 133, 100, 135, 72, 72, 95, 52, 100, 104, 51, 91, 130, 115, 127, 109, 69, 62, 50, 136, 125, 78, 104, 148, 105, 129, 99, 63, 117, 146]
第90次随机:[98, 144, 51, 130, 65, 51, 87, 68, 74, 135, 81, 84, 85, 138, 150, 86, 142, 99, 140, 91, 136, 147, 111, 122, 127, 54, 78, 65, 127, 134, 85, 141, 57, 60, 68, 75, 121, 140, 133, 93, 58, 63, 74, 65, 147, 114, 63, 94, 127, 122]
第91次随机:[71, 69, 139, 58, 118, 64, 73, 147, 78, 83, 138, 142, 69, 52, 121, 93, 132, 70, 126, 59, 64, 96, 148, 116, 74, 147, 82, 57, 74, 122, 58, 56, 63, 125, 51, 147, 118, 134, 98, 113, 144, 134, 137, 56, 136, 84, 93, 205, 96, 70]
第92次随机:[123, 55, 138, 112, 134, 190, 68, 50, 141, 127, 60, 144, 120, 110, 51, 131, 148, 92, 59, 81, 93, 50, 72, 100, 55, 109, 139, 65, 52, 112, 123, 60, 99, 124, 119, 54, 54, 133, 123, 85, 143, 55, 128, 85, 99, 144, 216, 64, 51, 60]
第93次随机:[70, 124, 96, 138, 106, 73, 146, 74, 76, 127, 82, 68, 75, 88, 112, 70, 150, 149, 85, 135, 134, 138, 123, 132, 122, 66, 103, 116, 77, 65, 135, 59, 90, 149, 133, 51, 96, 95, 119, 64, 76, 60, 66, 94, 75, 150, 50, 133, 79, 106]
第94次随机:[50, 111, 68, 63, 104, 83, 142, 76, 146, 148, 108, 100, 139, 72, 76, 66, 120, 60, 67, 149, 85, 127, 124, 73, 142, 111, 99, 54, 88, 68, 114, 130, 62, 133, 107, 121, 82, 57, 89, 119, 92, 121, 127, 121, 92, 148, 146, 72, 68, 80]
第95次随机:[145, 86, 117, 50, 75, 67, 93, 79, 94, 98, 69, 71, 94, 86, 64, 99, 131, 143, 110, 138, 115, 78, 64, 63, 131, 80, 55, 59, 99, 144, 115, 92, 132, 143, 69, 90, 93, 82, 75, 55, 148, 141, 69, 150, 145, 138, 148, 177, 59, 82]
第96次随机:[80, 67, 109, 299, 100, 67, 55, 136, 55, 96, 74, 122, 141, 50, 67, 87, 76, 139, 131, 57, 112, 109, 119, 66, 147, 96, 66, 98, 69, 133, 80, 317, 69, 66, 55, 54, 102, 138, 78, 142, 64, 66, 125, 75, 64, 79, 103, 137, 77, 86]
第97次随机:[84, 58, 90, 89, 125, 124, 106, 79, 140, 118, 81, 70, 117, 301, 100, 70, 50, 75, 146, 148, 100, 144, 102, 135, 73, 62, 51, 118, 80, 113, 60, 67, 131, 120, 83, 147, 136, 399, 125, 65, 50, 50, 50, 63, 50, 54, 50, 50, 51, 50]
第98次随机:[122, 121, 66, 83, 58, 142, 112, 117, 385, 124, 51, 63, 84, 103, 141, 140, 51, 93, 134, 68, 123, 50, 57, 86, 339, 64, 79, 62, 50, 60, 65, 72, 141, 57, 63, 363, 61, 71, 57, 57, 57, 168, 67, 59, 54, 53, 80, 50, 53, 124]
第99次随机:[90, 141, 137, 90, 90, 120, 96, 63, 55, 52, 128, 88, 144, 106, 114, 56, 81, 73, 128, 70, 76, 134, 86, 78, 141, 65, 109, 142, 127, 125, 118, 75, 91, 115, 58, 144, 73, 128, 238, 66, 56, 69, 51, 74, 56, 146, 142, 117, 72, 106]
第100次随机:[147, 65, 80, 96, 114, 52, 115, 86, 104, 92, 99, 90, 88, 133, 50, 99, 117, 96, 60, 53, 126, 132, 131, 148, 145, 67, 59, 82, 80, 81, 140, 63, 95, 112, 65, 132, 100, 63, 145, 132, 73, 61, 95, 143, 376, 54, 54, 57, 103, 50]
最小值50平均出现次数:1
大区间值150~400平均出现次数:1
View Code

  从结果可以看出,对尾出现最小值的情况已经基本不存在了,而且红包分配中有一定概率出现,基本上满足了需求。如果希望波动大数据出现概率大一些,可以手动调整概率,修改如下:

/**
 * 随机分配第n个红包
 * @param totalBonus 总红包量
 * @param totalNum 总份数
 * @param sendedBonus 已发送红包量
 * @param sendedNum 已发送份数
 * @param rdMin 随机下限
 * @param rdMax 随机上限
 * @return
 */
private static Integer randomBonusWithSpecifyBound(Integer totalBonus, Integer totalNum, Integer sendedBonus,
        Integer sendedNum, Integer rdMin, Integer rdMax, double bigRate) {
    Integer avg = totalBonus / totalNum;  // 平均值
    Integer leftLen = avg - rdMin;  
    Integer rightLen = rdMax - avg;
    Integer boundMin = 0, boundMax = 0;
    
    // 大范围设置小概率
    if (leftLen.equals(rightLen)) {
        boundMin = Math.max((totalBonus - sendedBonus - (totalNum - sendedNum - 1) * rdMax), rdMin);
        boundMax = Math.min((totalBonus - sendedBonus - (totalNum - sendedNum - 1) * rdMin), rdMax);
    } else if (rightLen.compareTo(leftLen) > 0) {
        // 上限偏离
        Integer standardRdMax = avg + leftLen;  // 右侧对称上限点
        Integer _rdMax = canReward(bigRate) ? rdMax : standardRdMax;
        boundMin = Math.max((totalBonus - sendedBonus - (totalNum - sendedNum - 1) * standardRdMax), rdMin);
        boundMax = Math.min((totalBonus - sendedBonus - (totalNum - sendedNum - 1) * rdMin), _rdMax);
    } else {
        // 下限偏离
        Integer standardRdMin = avg - rightLen;  // 左侧对称下限点
        Integer _rdMin = canReward(bigRate) ? rdMin : standardRdMin;
        boundMin = Math.max((totalBonus - sendedBonus - (totalNum - sendedNum - 1) * rdMax), _rdMin);
        boundMax = Math.min((totalBonus - sendedBonus - (totalNum - sendedNum - 1) * standardRdMin), rdMax);
    } 
    
    // 已发平均值偏移修正-动态比例
    if (boundMin.equals(boundMax)) {
        return getRandomVal(boundMin, boundMax);
    }
    double currAvg = sendedNum == 0 ? (double)avg : (sendedBonus / (double)sendedNum);  // 当前已发平均值
    double middle = (boundMin + boundMax) / 2.0;
    Integer subMin = boundMin, subMax = boundMax;
    // 期望值 
    double exp = avg - (currAvg - avg) * sendedNum / (double)(totalNum - sendedNum);
    if (middle > exp) {
        subMax = (int) Math.round((boundMin + exp) / 2.0);
    } else {
        subMin = (int) Math.round((exp + boundMax) / 2.0);
    }
    Integer expBound = (boundMin + boundMax) / 2;
    Integer expSub = (subMin + subMax) / 2;
    double subRate = (exp - expBound) / (double)(expSub - expBound);
    return getRandomValWithSpecifySubRate(boundMin, boundMax, subMin, subMax, subRate);
}


/**
 * 生成红包一次分配结果
 * @param totalBonus
 * @param totalNum
 * @param rdMin
 * @param rdMax
 * @param bigRate 指定大范围区间的概率
 * @return
 */
public static List<Integer> createBonusList(Integer totalBonus, Integer totalNum, Integer rdMin, Integer rdMax, double bigRate) {
    Integer sendedBonus = 0;
    Integer sendedNum = 0;
    List<Integer> bonusList = new ArrayList<>();
    while (sendedNum < totalNum) {
        Integer bonus = randomBonusWithSpecifyBound(totalBonus, totalNum, sendedBonus, sendedNum, rdMin, rdMax, bigRate);
        bonusList.add(bonus);
        sendedNum++;
        sendedBonus += bonus;
    }
    return bonusList;
} 
View Code

  再测试运行100次createBonusList(5000, 50, 50, 400, 0.8),结果如下:

第1次随机:[58, 54, 51, 60, 68, 73, 91, 76, 128, 50, 130, 68, 73, 148, 71, 73, 78, 59, 77, 111, 82, 70, 75, 281, 78, 64, 250, 100, 60, 73, 307, 59, 50, 77, 122, 69, 138, 72, 61, 56, 65, 66, 103, 148, 127, 150, 150, 150, 150, 150]
第2次随机:[121, 93, 305, 102, 58, 85, 364, 65, 130, 64, 65, 68, 56, 70, 97, 65, 54, 66, 66, 59, 61, 150, 51, 376, 67, 62, 65, 56, 55, 211, 61, 68, 70, 73, 68, 54, 62, 100, 107, 57, 67, 58, 65, 53, 372, 237, 50, 69, 52, 50]
第3次随机:[66, 54, 59, 87, 62, 50, 77, 59, 51, 68, 209, 76, 59, 57, 151, 50, 61, 73, 71, 55, 69, 81, 68, 62, 76, 52, 57, 382, 55, 103, 68, 133, 370, 52, 69, 336, 238, 63, 60, 76, 61, 55, 96, 81, 62, 144, 99, 150, 140, 147]
第4次随机:[326, 144, 63, 57, 72, 98, 73, 57, 71, 71, 56, 72, 57, 55, 60, 68, 56, 68, 90, 74, 78, 299, 53, 61, 52, 179, 206, 71, 75, 54, 72, 59, 209, 73, 73, 146, 148, 63, 85, 78, 50, 69, 79, 141, 121, 140, 130, 148, 150, 150]
第5次随机:[64, 66, 74, 310, 66, 52, 268, 70, 69, 52, 64, 103, 64, 71, 56, 75, 69, 61, 52, 141, 62, 61, 71, 52, 54, 65, 59, 51, 54, 138, 64, 67, 54, 115, 60, 147, 58, 121, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150]
第6次随机:[57, 63, 66, 254, 58, 75, 75, 56, 70, 72, 75, 60, 54, 52, 186, 51, 70, 50, 140, 75, 62, 136, 54, 119, 55, 116, 400, 54, 260, 58, 67, 173, 58, 382, 63, 55, 60, 68, 84, 53, 67, 59, 70, 57, 80, 65, 116, 150, 150, 150]
第7次随机:[67, 143, 267, 68, 120, 53, 66, 68, 64, 382, 194, 66, 194, 66, 68, 54, 60, 63, 56, 56, 255, 370, 53, 60, 115, 62, 91, 54, 64, 61, 50, 83, 82, 54, 60, 63, 58, 59, 67, 59, 243, 50, 52, 110, 59, 51, 55, 106, 131, 148]
第8次随机:[238, 134, 65, 74, 59, 276, 64, 60, 59, 69, 68, 313, 51, 66, 61, 72, 70, 115, 379, 56, 54, 69, 55, 50, 51, 200, 70, 62, 137, 55, 55, 209, 59, 54, 151, 59, 51, 62, 126, 378, 56, 51, 51, 134, 54, 54, 70, 67, 56, 51]
第9次随机:[62, 117, 73, 54, 51, 116, 58, 67, 71, 53, 52, 52, 80, 69, 54, 60, 148, 146, 77, 86, 149, 63, 81, 73, 70, 135, 71, 72, 140, 87, 282, 58, 76, 97, 140, 53, 90, 137, 57, 76, 148, 112, 149, 140, 148, 150, 150, 150, 150, 150]
第10次随机:[73, 71, 132, 53, 316, 206, 67, 311, 67, 52, 123, 69, 135, 52, 52, 67, 66, 52, 67, 69, 202, 83, 72, 68, 376, 51, 165, 51, 58, 66, 68, 280, 54, 56, 52, 65, 143, 54, 139, 51, 69, 120, 134, 51, 52, 56, 53, 52, 92, 67]
第11次随机:[72, 146, 59, 52, 60, 137, 72, 102, 55, 155, 60, 61, 68, 50, 230, 50, 63, 72, 52, 76, 134, 52, 119, 61, 58, 58, 64, 55, 83, 158, 54, 139, 122, 75, 84, 148, 75, 57, 276, 200, 51, 66, 379, 169, 55, 113, 53, 147, 131, 72]
第12次随机:[367, 63, 63, 65, 51, 54, 74, 192, 144, 60, 60, 60, 51, 105, 56, 64, 56, 166, 123, 52, 226, 283, 50, 64, 70, 340, 51, 56, 67, 244, 65, 52, 63, 59, 66, 59, 70, 140, 67, 69, 58, 60, 57, 146, 127, 72, 112, 94, 73, 114]
第13次随机:[64, 85, 108, 76, 75, 80, 69, 105, 66, 66, 65, 70, 326, 67, 112, 86, 61, 73, 54, 267, 62, 59, 64, 148, 239, 326, 60, 50, 111, 68, 71, 52, 55, 66, 51, 51, 54, 64, 53, 274, 51, 75, 76, 83, 71, 93, 148, 150, 150, 150]
第14次随机:[85, 104, 89, 70, 62, 72, 257, 75, 377, 53, 53, 115, 140, 61, 65, 63, 59, 326, 55, 69, 51, 73, 52, 69, 61, 74, 317, 54, 104, 80, 66, 65, 106, 109, 333, 55, 62, 80, 61, 58, 62, 56, 64, 71, 85, 50, 121, 58, 132, 121]
第15次随机:[68, 56, 359, 129, 60, 55, 57, 75, 108, 64, 50, 122, 66, 62, 65, 53, 171, 64, 66, 74, 50, 66, 60, 394, 192, 58, 60, 68, 57, 76, 73, 243, 58, 63, 67, 137, 71, 75, 133, 78, 79, 77, 57, 64, 149, 348, 120, 94, 53, 56]
第16次随机:[69, 150, 111, 72, 319, 70, 104, 58, 59, 70, 68, 71, 59, 58, 66, 139, 59, 95, 122, 68, 52, 55, 51, 59, 264, 57, 299, 54, 388, 139, 112, 58, 53, 50, 88, 67, 99, 151, 58, 59, 67, 50, 125, 251, 88, 80, 53, 59, 67, 60]
第17次随机:[74, 321, 65, 60, 64, 62, 64, 72, 294, 192, 59, 56, 66, 69, 146, 70, 104, 63, 73, 251, 71, 63, 59, 70, 96, 55, 62, 71, 241, 72, 98, 56, 50, 67, 59, 73, 77, 65, 178, 50, 52, 281, 91, 52, 73, 247, 50, 193, 52, 51]
第18次随机:[68, 65, 140, 81, 327, 258, 56, 54, 56, 89, 303, 53, 93, 64, 184, 101, 58, 53, 61, 314, 138, 62, 50, 78, 67, 54, 205, 61, 50, 145, 54, 56, 54, 53, 55, 342, 56, 51, 62, 59, 61, 55, 50, 65, 53, 66, 99, 51, 126, 144]
第19次随机:[85, 54, 307, 71, 61, 64, 64, 246, 55, 72, 60, 74, 57, 52, 53, 101, 53, 52, 67, 63, 146, 58, 99, 62, 83, 51, 60, 69, 80, 64, 313, 55, 223, 70, 67, 67, 85, 146, 67, 89, 83, 61, 145, 146, 150, 150, 150, 150, 150, 150]
第20次随机:[61, 50, 72, 70, 114, 72, 68, 369, 270, 67, 56, 55, 55, 67, 240, 63, 71, 64, 315, 359, 52, 58, 66, 103, 51, 60, 59, 53, 61, 70, 66, 62, 62, 141, 65, 70, 57, 149, 58, 73, 63, 73, 52, 56, 211, 55, 87, 129, 212, 68]
第21次随机:[99, 234, 62, 68, 62, 51, 169, 51, 68, 60, 146, 144, 74, 61, 305, 71, 67, 261, 69, 68, 64, 57, 70, 76, 70, 63, 108, 339, 58, 64, 65, 65, 58, 74, 162, 52, 273, 66, 60, 65, 109, 61, 357, 51, 52, 51, 51, 52, 63, 54]
第22次随机:[67, 57, 78, 60, 332, 53, 62, 52, 189, 145, 51, 55, 73, 65, 54, 56, 126, 102, 63, 50, 51, 82, 52, 65, 59, 156, 97, 64, 58, 184, 90, 57, 78, 68, 82, 64, 69, 86, 106, 142, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150]
第23次随机:[266, 53, 70, 67, 65, 140, 129, 64, 286, 61, 367, 66, 270, 56, 61, 58, 68, 62, 73, 59, 59, 62, 54, 56, 70, 61, 90, 380, 65, 65, 59, 138, 55, 116, 51, 64, 50, 52, 64, 120, 63, 127, 57, 61, 73, 150, 210, 60, 77, 50]
第24次随机:[59, 68, 114, 63, 167, 59, 76, 68, 83, 97, 57, 81, 71, 61, 101, 170, 62, 75, 131, 59, 55, 139, 55, 105, 138, 68, 66, 87, 150, 136, 80, 339, 65, 66, 67, 117, 63, 74, 77, 201, 67, 52, 85, 64, 113, 149, 150, 150, 150, 150]
第25次随机:[56, 64, 64, 50, 276, 309, 50, 66, 298, 54, 51, 67, 60, 71, 55, 67, 70, 59, 55, 68, 54, 77, 312, 105, 55, 71, 146, 70, 338, 62, 57, 153, 55, 65, 67, 62, 71, 52, 70, 108, 81, 67, 71, 66, 60, 182, 69, 149, 146, 149]
第26次随机:[51, 78, 74, 59, 67, 51, 379, 68, 56, 66, 91, 282, 60, 187, 322, 68, 50, 52, 128, 354, 74, 55, 58, 92, 64, 123, 250, 59, 58, 63, 59, 57, 51, 66, 55, 54, 50, 64, 181, 57, 52, 65, 64, 63, 69, 68, 150, 78, 109, 149]
第27次随机:[56, 69, 51, 61, 53, 257, 63, 161, 279, 60, 69, 71, 62, 51, 67, 124, 138, 57, 161, 109, 53, 138, 59, 52, 137, 149, 69, 277, 70, 57, 269, 338, 60, 56, 56, 57, 59, 56, 55, 53, 57, 66, 344, 61, 51, 53, 54, 50, 52, 73]
第28次随机:[64, 51, 74, 81, 54, 58, 88, 141, 70, 60, 63, 75, 133, 72, 53, 54, 62, 63, 145, 140, 55, 217, 56, 68, 70, 60, 84, 148, 76, 75, 136, 86, 89, 226, 332, 137, 62, 51, 63, 287, 127, 65, 53, 150, 293, 97, 54, 54, 71, 57]
第29次随机:[59, 60, 73, 57, 234, 54, 51, 56, 159, 146, 51, 79, 112, 66, 126, 148, 73, 71, 175, 85, 98, 57, 58, 53, 350, 69, 51, 222, 148, 53, 64, 62, 72, 142, 55, 55, 332, 58, 55, 54, 126, 57, 248, 55, 50, 154, 69, 60, 77, 61]
第30次随机:[117, 65, 53, 112, 52, 219, 105, 73, 63, 69, 115, 137, 66, 70, 73, 77, 56, 70, 65, 51, 57, 73, 147, 73, 57, 66, 132, 377, 98, 61, 68, 123, 62, 60, 58, 67, 70, 65, 149, 84, 359, 52, 146, 211, 61, 74, 80, 90, 125, 147]
第31次随机:[64, 93, 79, 72, 100, 350, 150, 65, 53, 63, 74, 52, 63, 57, 73, 127, 52, 121, 306, 73, 133, 64, 59, 150, 68, 58, 353, 61, 75, 53, 58, 58, 52, 64, 54, 76, 314, 51, 377, 145, 53, 79, 53, 61, 53, 52, 54, 52, 52, 81]
第32次随机:[57, 63, 55, 105, 130, 50, 92, 54, 65, 50, 66, 77, 55, 145, 76, 372, 67, 216, 62, 146, 61, 57, 79, 259, 53, 73, 66, 131, 65, 51, 69, 95, 124, 75, 68, 83, 61, 63, 77, 64, 99, 369, 136, 76, 53, 124, 141, 183, 51, 91]
第33次随机:[53, 57, 51, 64, 62, 68, 81, 128, 123, 51, 128, 71, 130, 64, 140, 65, 334, 56, 76, 91, 50, 71, 64, 73, 74, 72, 53, 50, 66, 379, 131, 113, 69, 116, 56, 68, 66, 55, 63, 83, 194, 73, 264, 184, 58, 69, 86, 109, 149, 149]
第34次随机:[62, 69, 50, 66, 65, 75, 77, 62, 60, 70, 58, 138, 56, 68, 219, 134, 68, 111, 63, 57, 258, 74, 69, 187, 55, 61, 56, 68, 311, 66, 74, 52, 69, 70, 216, 126, 133, 77, 64, 124, 82, 53, 78, 81, 123, 145, 150, 150, 150, 150]
第35次随机:[73, 97, 75, 58, 58, 58, 58, 63, 130, 101, 148, 309, 68, 52, 59, 74, 61, 57, 60, 70, 80, 359, 74, 74, 54, 52, 94, 50, 61, 309, 107, 84, 54, 51, 72, 52, 87, 51, 51, 142, 84, 147, 69, 379, 51, 219, 152, 83, 64, 65]
第36次随机:[115, 103, 59, 57, 57, 148, 50, 76, 56, 79, 82, 71, 199, 128, 213, 73, 69, 170, 70, 68, 348, 55, 52, 69, 113, 54, 62, 150, 52, 71, 114, 65, 123, 64, 106, 67, 71, 144, 64, 59, 132, 81, 57, 68, 71, 145, 150, 150, 150, 150]
第37次随机:[61, 61, 59, 69, 50, 130, 88, 74, 52, 76, 189, 56, 149, 56, 89, 62, 144, 336, 324, 53, 53, 67, 65, 63, 51, 51, 56, 148, 52, 300, 66, 59, 58, 364, 51, 102, 55, 57, 54, 58, 104, 173, 53, 122, 65, 73, 71, 50, 133, 148]
第38次随机:[75, 71, 50, 176, 62, 73, 52, 166, 263, 51, 74, 263, 389, 65, 57, 98, 105, 61, 63, 156, 50, 67, 70, 62, 55, 65, 69, 58, 57, 56, 55, 118, 57, 56, 100, 67, 145, 77, 149, 159, 72, 66, 291, 63, 231, 51, 58, 78, 61, 67]
第39次随机:[239, 61, 59, 74, 66, 56, 66, 56, 95, 55, 65, 58, 60, 61, 54, 83, 240, 78, 156, 90, 111, 51, 357, 382, 67, 369, 50, 61, 62, 58, 144, 57, 65, 52, 65, 51, 67, 64, 60, 69, 62, 53, 328, 57, 63, 61, 60, 59, 145, 78]
第40次随机:[326, 79, 60, 181, 54, 134, 59, 254, 68, 50, 56, 56, 90, 133, 57, 52, 121, 51, 143, 65, 270, 66, 127, 69, 69, 60, 53, 56, 55, 64, 257, 57, 332, 62, 64, 63, 62, 51, 52, 56, 62, 67, 57, 76, 98, 66, 103, 138, 149, 150]
第41次随机:[73, 66, 198, 65, 125, 120, 62, 56, 72, 61, 57, 74, 50, 52, 70, 391, 225, 105, 158, 59, 66, 283, 52, 64, 58, 70, 76, 125, 53, 71, 398, 291, 53, 94, 57, 60, 316, 50, 51, 50, 51, 50, 50, 52, 64, 50, 50, 55, 51, 50]
第42次随机:[79, 94, 241, 84, 72, 60, 51, 74, 293, 59, 64, 352, 62, 120, 204, 53, 53, 58, 59, 62, 71, 61, 111, 138, 56, 396, 59, 132, 59, 61, 52, 51, 53, 90, 70, 55, 62, 60, 51, 56, 69, 74, 383, 87, 52, 53, 55, 64, 84, 141]
第43次随机:[63, 53, 54, 76, 89, 100, 57, 70, 74, 54, 222, 52, 74, 55, 73, 138, 138, 60, 51, 130, 94, 75, 50, 104, 390, 66, 58, 139, 313, 59, 68, 357, 223, 54, 50, 89, 63, 131, 59, 60, 359, 50, 53, 50, 51, 52, 50, 50, 50, 50]
第44次随机:[75, 108, 64, 73, 69, 88, 61, 70, 59, 76, 55, 95, 79, 76, 178, 62, 72, 73, 148, 124, 259, 317, 87, 257, 60, 72, 99, 61, 114, 74, 67, 289, 52, 55, 159, 67, 305, 54, 59, 55, 53, 50, 56, 65, 55, 119, 65, 129, 76, 65]
第45次随机:[90, 135, 107, 393, 53, 383, 68, 56, 62, 66, 395, 82, 373, 59, 336, 51, 56, 56, 59, 51, 54, 59, 54, 77, 94, 59, 54, 242, 96, 53, 52, 51, 139, 53, 50, 53, 50, 54, 55, 62, 84, 54, 54, 114, 50, 50, 50, 50, 51, 51]
第46次随机:[67, 357, 61, 58, 303, 65, 116, 61, 59, 54, 234, 58, 67, 58, 62, 220, 172, 55, 74, 53, 58, 50, 276, 63, 56, 277, 51, 57, 59, 199, 54, 119, 57, 62, 57, 57, 64, 59, 143, 51, 59, 66, 66, 53, 162, 57, 202, 55, 102, 55]
第47次随机:[60, 74, 73, 50, 143, 56, 67, 59, 59, 229, 73, 62, 56, 61, 76, 67, 92, 67, 135, 59, 215, 78, 125, 68, 75, 359, 69, 50, 61, 102, 346, 53, 226, 104, 196, 62, 132, 63, 61, 63, 52, 61, 52, 73, 54, 55, 100, 133, 145, 149]
第48次随机:[75, 55, 57, 78, 73, 129, 66, 59, 63, 296, 57, 95, 224, 59, 58, 75, 69, 67, 72, 131, 98, 62, 104, 74, 75, 369, 62, 67, 330, 52, 55, 52, 83, 56, 63, 65, 55, 65, 250, 66, 140, 55, 63, 71, 91, 137, 77, 135, 125, 145]
第49次随机:[54, 72, 68, 76, 133, 65, 122, 61, 78, 75, 144, 51, 77, 349, 71, 58, 89, 62, 59, 199, 60, 71, 393, 57, 83, 56, 50, 59, 55, 69, 77, 72, 55, 65, 143, 69, 80, 315, 75, 386, 58, 59, 58, 61, 64, 57, 56, 59, 125, 150]
第50次随机:[144, 94, 64, 65, 53, 356, 53, 121, 58, 69, 65, 148, 146, 78, 63, 85, 67, 71, 67, 144, 95, 58, 66, 63, 109, 60, 57, 64, 62, 121, 70, 77, 76, 314, 72, 68, 72, 69, 198, 59, 322, 66, 60, 134, 52, 56, 212, 66, 129, 62]
第51次随机:[109, 115, 61, 123, 130, 51, 365, 66, 71, 50, 110, 51, 62, 62, 70, 229, 54, 118, 61, 74, 50, 76, 65, 125, 55, 64, 55, 63, 380, 50, 366, 165, 262, 58, 58, 202, 51, 51, 51, 56, 55, 51, 50, 60, 58, 183, 53, 54, 50, 51]
第52次随机:[354, 54, 209, 68, 80, 50, 53, 321, 60, 66, 114, 58, 172, 69, 131, 62, 360, 64, 59, 61, 51, 64, 69, 65, 51, 83, 62, 277, 50, 55, 56, 56, 60, 260, 51, 57, 60, 66, 54, 50, 52, 56, 71, 69, 77, 171, 59, 94, 142, 147]
第53次随机:[74, 75, 149, 186, 73, 104, 51, 80, 74, 366, 57, 65, 52, 72, 63, 67, 176, 120, 65, 59, 100, 75, 382, 70, 53, 231, 57, 70, 57, 61, 53, 63, 65, 124, 70, 65, 65, 400, 54, 57, 50, 67, 56, 54, 61, 312, 50, 50, 50, 50]
第54次随机:[65, 60, 59, 61, 138, 71, 288, 73, 68, 68, 56, 69, 291, 54, 74, 79, 74, 52, 66, 70, 234, 62, 212, 85, 59, 52, 75, 66, 61, 347, 256, 56, 55, 72, 139, 63, 65, 83, 65, 59, 111, 74, 127, 66, 316, 68, 53, 52, 51, 80]
第55次随机:[110, 73, 58, 68, 68, 52, 64, 65, 74, 64, 164, 74, 199, 67, 73, 59, 53, 146, 58, 73, 208, 96, 73, 56, 150, 244, 134, 81, 68, 140, 51, 134, 65, 54, 256, 51, 126, 70, 56, 61, 90, 64, 143, 139, 72, 84, 150, 128, 144, 150]
第56次随机:[58, 367, 133, 71, 59, 60, 56, 232, 62, 58, 57, 68, 69, 219, 65, 153, 72, 62, 66, 60, 61, 156, 52, 74, 65, 72, 147, 58, 64, 92, 54, 86, 51, 54, 67, 65, 52, 66, 62, 87, 150, 124, 146, 148, 150, 150, 150, 150, 150, 150]
第57次随机:[342, 72, 67, 50, 59, 61, 122, 50, 60, 82, 64, 62, 73, 64, 76, 71, 70, 61, 66, 67, 60, 133, 79, 71, 140, 217, 52, 147, 110, 110, 54, 73, 135, 58, 278, 196, 91, 116, 76, 75, 113, 61, 140, 74, 63, 350, 59, 81, 98, 51]
第58次随机:[58, 56, 66, 62, 71, 66, 387, 54, 393, 59, 71, 69, 129, 102, 392, 58, 62, 157, 67, 124, 55, 59, 68, 129, 58, 337, 150, 56, 317, 55, 51, 54, 53, 52, 51, 50, 56, 131, 52, 52, 152, 58, 50, 50, 50, 50, 50, 50, 51, 50]
第59次随机:[75, 64, 226, 59, 330, 199, 59, 69, 69, 65, 68, 56, 272, 54, 60, 102, 86, 63, 71, 67, 328, 68, 57, 223, 56, 76, 54, 56, 61, 54, 63, 61, 63, 59, 70, 60, 69, 67, 59, 356, 61, 366, 54, 118, 51, 53, 50, 72, 51, 50]
第60次随机:[72, 59, 344, 67, 257, 57, 64, 107, 61, 68, 125, 57, 71, 70, 53, 142, 62, 115, 72, 73, 66, 69, 56, 56, 90, 74, 70, 64, 52, 52, 77, 335, 139, 278, 50, 52, 342, 54, 56, 61, 254, 61, 61, 52, 135, 54, 58, 128, 55, 53]
第61次随机:[74, 60, 70, 60, 62, 151, 124, 258, 67, 74, 59, 149, 56, 332, 65, 281, 51, 59, 128, 59, 69, 60, 71, 131, 361, 130, 94, 60, 55, 59, 63, 131, 59, 55, 86, 51, 253, 50, 62, 62, 134, 53, 54, 56, 52, 64, 87, 137, 87, 75]
第62次随机:[61, 119, 59, 120, 102, 60, 56, 61, 67, 70, 50, 60, 66, 76, 52, 72, 71, 58, 135, 133, 346, 74, 63, 185, 103, 124, 121, 64, 151, 62, 212, 60, 59, 72, 55, 56, 54, 84, 96, 83, 218, 306, 55, 55, 80, 74, 101, 145, 215, 79]
第63次随机:[191, 62, 73, 103, 350, 60, 51, 111, 53, 79, 63, 64, 66, 53, 55, 128, 392, 63, 377, 67, 174, 53, 279, 248, 55, 57, 59, 57, 57, 60, 58, 58, 59, 86, 54, 57, 63, 62, 56, 57, 57, 66, 65, 69, 107, 70, 179, 111, 53, 53]
第64次随机:[200, 365, 87, 51, 138, 68, 175, 66, 50, 240, 62, 64, 53, 342, 63, 62, 228, 108, 57, 50, 51, 58, 60, 61, 214, 54, 57, 60, 57, 52, 55, 246, 126, 53, 62, 71, 65, 57, 61, 62, 164, 57, 66, 93, 61, 78, 184, 53, 65, 68]
第65次随机:[115, 67, 379, 177, 53, 125, 70, 104, 63, 246, 69, 50, 65, 148, 64, 108, 124, 99, 62, 62, 61, 53, 72, 63, 104, 56, 73, 60, 301, 186, 52, 66, 63, 231, 259, 51, 250, 50, 50, 50, 53, 54, 56, 52, 50, 50, 134, 50, 50, 50]
第66次随机:[244, 171, 55, 69, 53, 56, 69, 68, 228, 61, 61, 346, 53, 64, 257, 67, 310, 236, 55, 65, 50, 65, 66, 56, 60, 50, 63, 106, 68, 53, 109, 68, 59, 60, 55, 54, 74, 315, 54, 64, 54, 60, 60, 52, 104, 116, 140, 58, 108, 111]
第67次随机:[98, 67, 61, 50, 65, 94, 65, 71, 80, 148, 126, 216, 68, 75, 134, 56, 132, 61, 58, 64, 275, 53, 273, 62, 60, 68, 136, 59, 266, 56, 176, 283, 54, 61, 100, 54, 59, 79, 118, 55, 60, 70, 58, 164, 51, 244, 56, 53, 51, 57]
第68次随机:[68, 50, 130, 76, 156, 60, 99, 69, 72, 59, 70, 64, 58, 62, 73, 57, 78, 59, 139, 72, 100, 65, 69, 69, 144, 66, 82, 263, 53, 68, 61, 67, 268, 224, 71, 266, 77, 61, 79, 82, 71, 67, 76, 99, 150, 138, 143, 150, 150, 150]
第69次随机:[57, 65, 74, 279, 91, 127, 57, 55, 218, 66, 63, 284, 123, 125, 62, 61, 53, 346, 67, 51, 147, 64, 54, 59, 52, 351, 60, 143, 62, 56, 93, 120, 54, 65, 55, 60, 57, 51, 64, 61, 84, 59, 222, 58, 54, 109, 162, 52, 70, 78]
第70次随机:[74, 64, 68, 64, 270, 65, 75, 57, 51, 70, 73, 400, 66, 52, 65, 70, 60, 96, 65, 180, 341, 150, 53, 61, 102, 197, 64, 50, 145, 59, 57, 58, 62, 53, 50, 55, 65, 64, 179, 59, 64, 63, 83, 71, 137, 100, 124, 149, 150, 150]
第71次随机:[63, 51, 56, 61, 52, 61, 78, 64, 54, 60, 72, 147, 95, 75, 55, 97, 54, 81, 70, 322, 60, 74, 78, 52, 73, 136, 248, 331, 78, 60, 56, 70, 80, 398, 351, 54, 50, 230, 51, 54, 94, 151, 77, 54, 87, 54, 54, 76, 51, 50]
第72次随机:[68, 362, 61, 58, 54, 65, 64, 100, 68, 63, 67, 65, 209, 324, 52, 53, 129, 54, 291, 89, 149, 56, 52, 241, 58, 65, 60, 55, 56, 355, 52, 59, 86, 62, 61, 54, 56, 68, 51, 68, 71, 76, 56, 62, 55, 78, 100, 142, 150, 150]
第73次随机:[156, 62, 143, 171, 69, 72, 337, 93, 58, 68, 182, 70, 58, 64, 64, 72, 57, 139, 56, 73, 60, 97, 68, 61, 65, 60, 72, 76, 54, 95, 198, 51, 68, 89, 61, 274, 367, 56, 201, 103, 138, 64, 54, 52, 145, 56, 55, 55, 89, 52]
第74次随机:[146, 107, 63, 65, 97, 141, 55, 51, 74, 133, 56, 307, 64, 65, 53, 57, 126, 63, 59, 63, 62, 77, 150, 109, 378, 65, 91, 177, 72, 72, 126, 65, 101, 88, 58, 59, 142, 344, 57, 52, 66, 74, 62, 206, 51, 57, 56, 92, 67, 79]
第75次随机:[54, 75, 129, 65, 66, 72, 67, 112, 65, 54, 77, 53, 66, 146, 333, 176, 65, 75, 71, 58, 67, 65, 61, 66, 110, 61, 306, 309, 51, 83, 64, 54, 67, 74, 126, 65, 71, 71, 56, 212, 68, 109, 71, 142, 398, 75, 59, 53, 57, 50]
第76次随机:[68, 74, 61, 74, 52, 79, 52, 215, 63, 58, 69, 70, 52, 127, 134, 69, 64, 73, 66, 119, 71, 51, 83, 80, 58, 79, 116, 74, 61, 77, 323, 79, 80, 144, 50, 87, 52, 156, 93, 145, 70, 150, 138, 145, 149, 150, 150, 150, 150, 150]
第77次随机:[360, 56, 56, 63, 138, 69, 72, 68, 80, 63, 74, 61, 55, 283, 109, 233, 67, 67, 52, 98, 142, 54, 73, 57, 71, 177, 125, 188, 62, 66, 56, 99, 60, 69, 59, 108, 234, 51, 60, 78, 148, 51, 63, 85, 74, 314, 53, 68, 69, 62]
第78次随机:[113, 50, 56, 73, 108, 114, 323, 147, 54, 61, 53, 83, 72, 55, 143, 270, 57, 69, 57, 65, 61, 143, 156, 53, 298, 77, 66, 60, 141, 69, 51, 146, 63, 62, 72, 168, 71, 58, 66, 64, 51, 389, 56, 61, 54, 52, 57, 69, 105, 138]
第79次随机:[75, 69, 55, 303, 87, 71, 51, 74, 63, 56, 109, 71, 131, 147, 63, 51, 71, 131, 69, 75, 137, 105, 118, 73, 373, 276, 135, 56, 68, 57, 67, 50, 61, 70, 51, 280, 50, 60, 107, 69, 56, 66, 69, 211, 125, 183, 54, 50, 51, 50]
第80次随机:[67, 57, 57, 65, 73, 93, 125, 132, 52, 113, 60, 50, 71, 127, 78, 68, 50, 61, 60, 172, 73, 123, 94, 58, 67, 60, 56, 50, 74, 52, 143, 61, 264, 324, 224, 59, 64, 82, 276, 70, 202, 58, 74, 234, 65, 57, 75, 124, 131, 75]
第81次随机:[92, 57, 229, 138, 75, 71, 333, 56, 55, 58, 69, 246, 62, 58, 64, 381, 68, 66, 119, 106, 66, 57, 107, 57, 55, 62, 57, 243, 68, 64, 65, 370, 58, 62, 63, 53, 84, 51, 93, 63, 62, 58, 54, 239, 77, 50, 97, 52, 59, 51]
第82次随机:[63, 56, 365, 101, 67, 53, 88, 54, 117, 51, 70, 56, 55, 57, 65, 61, 73, 140, 166, 266, 74, 65, 59, 61, 51, 84, 282, 61, 385, 318, 66, 61, 54, 88, 61, 63, 53, 215, 50, 61, 54, 207, 60, 55, 121, 62, 52, 51, 52, 50]
第83次随机:[51, 158, 69, 50, 56, 274, 100, 67, 147, 58, 55, 400, 56, 60, 51, 215, 77, 112, 51, 51, 398, 53, 64, 79, 67, 68, 164, 52, 55, 59, 69, 70, 69, 68, 195, 191, 59, 50, 51, 65, 66, 67, 60, 299, 82, 114, 50, 50, 57, 51]
第84次随机:[71, 52, 69, 59, 146, 150, 399, 59, 54, 50, 68, 66, 100, 100, 231, 63, 317, 52, 115, 68, 53, 105, 279, 62, 68, 52, 59, 60, 97, 57, 88, 65, 64, 55, 89, 110, 147, 123, 52, 74, 52, 66, 58, 142, 293, 53, 94, 62, 71, 61]
第85次随机:[237, 50, 87, 69, 61, 127, 62, 52, 71, 93, 63, 61, 268, 50, 51, 60, 145, 55, 60, 140, 67, 140, 64, 77, 68, 67, 64, 69, 67, 172, 78, 56, 51, 137, 398, 59, 54, 296, 147, 60, 54, 61, 72, 65, 63, 145, 111, 101, 126, 149]
第86次随机:[63, 67, 112, 107, 56, 53, 59, 57, 65, 379, 50, 69, 56, 66, 57, 65, 65, 76, 77, 63, 53, 65, 128, 133, 57, 379, 75, 78, 67, 143, 70, 71, 141, 72, 182, 210, 69, 50, 79, 57, 84, 304, 53, 54, 326, 98, 56, 82, 51, 51]
第87次随机:[64, 127, 57, 61, 331, 60, 53, 60, 88, 66, 55, 51, 66, 89, 57, 294, 52, 63, 107, 72, 67, 58, 62, 65, 60, 54, 361, 55, 148, 58, 60, 147, 53, 53, 60, 65, 75, 110, 56, 167, 395, 132, 316, 104, 53, 50, 68, 70, 52, 53]
第88次随机:[93, 60, 74, 160, 137, 83, 55, 51, 58, 69, 52, 55, 376, 73, 60, 162, 65, 74, 57, 141, 262, 53, 73, 88, 52, 68, 312, 70, 71, 336, 55, 60, 350, 139, 52, 56, 55, 54, 56, 55, 57, 56, 57, 169, 51, 52, 51, 85, 72, 78]
第89次随机:[77, 148, 78, 74, 181, 54, 53, 392, 63, 52, 60, 63, 61, 56, 57, 56, 66, 197, 140, 65, 51, 68, 113, 54, 59, 122, 73, 70, 111, 77, 70, 127, 83, 62, 69, 54, 115, 145, 160, 198, 152, 122, 66, 198, 71, 70, 58, 89, 150, 150]
第90次随机:[74, 62, 74, 75, 53, 56, 52, 252, 157, 76, 52, 58, 77, 96, 277, 50, 122, 56, 70, 77, 59, 76, 65, 149, 57, 57, 78, 140, 379, 143, 65, 61, 84, 63, 70, 343, 55, 59, 62, 136, 252, 58, 204, 53, 56, 52, 67, 85, 50, 56]
第91次随机:[132, 51, 75, 62, 73, 71, 138, 50, 58, 355, 146, 121, 62, 52, 56, 62, 333, 68, 56, 64, 87, 58, 98, 115, 369, 66, 130, 121, 67, 50, 53, 55, 64, 64, 69, 72, 55, 72, 50, 55, 81, 78, 69, 150, 66, 101, 150, 150, 150, 150]
第92次随机:[122, 224, 133, 62, 68, 60, 63, 53, 75, 342, 57, 73, 69, 375, 62, 69, 68, 248, 53, 51, 150, 233, 64, 60, 65, 149, 64, 57, 61, 54, 53, 57, 79, 70, 52, 71, 54, 54, 58, 52, 61, 150, 132, 61, 50, 71, 142, 149, 150, 150]
第93次随机:[62, 52, 53, 63, 60, 57, 50, 394, 55, 67, 75, 72, 69, 57, 144, 55, 60, 74, 63, 135, 60, 72, 274, 50, 75, 229, 62, 140, 89, 72, 67, 56, 66, 78, 59, 51, 62, 66, 54, 148, 103, 150, 150, 150, 150, 150, 150, 150, 150, 150]
第94次随机:[115, 75, 50, 58, 66, 53, 345, 55, 50, 56, 73, 118, 75, 55, 58, 124, 77, 57, 144, 63, 68, 57, 65, 138, 290, 68, 271, 50, 73, 275, 50, 65, 66, 318, 357, 53, 58, 55, 58, 61, 62, 56, 61, 122, 50, 60, 54, 51, 91, 130]
第95次随机:[58, 56, 58, 56, 135, 68, 154, 59, 113, 71, 97, 57, 51, 69, 58, 363, 333, 67, 89, 67, 115, 51, 54, 315, 50, 53, 56, 58, 100, 320, 250, 101, 71, 52, 64, 50, 53, 56, 54, 65, 400, 55, 96, 52, 52, 51, 52, 73, 51, 51]
第96次随机:[65, 137, 66, 61, 68, 91, 56, 66, 71, 63, 190, 52, 102, 72, 191, 53, 74, 64, 398, 87, 75, 69, 63, 125, 55, 52, 53, 51, 113, 364, 57, 57, 64, 70, 50, 59, 52, 51, 55, 72, 384, 253, 64, 50, 58, 100, 80, 77, 150, 150]
第97次随机:[51, 54, 54, 117, 347, 352, 139, 68, 376, 50, 54, 134, 52, 55, 50, 288, 51, 61, 56, 145, 55, 54, 308, 60, 146, 56, 62, 60, 63, 146, 50, 53, 60, 57, 57, 58, 209, 154, 55, 51, 52, 53, 166, 51, 50, 50, 51, 52, 56, 51]
第98次随机:[228, 70, 51, 51, 60, 56, 66, 74, 77, 98, 67, 68, 220, 70, 198, 57, 318, 60, 72, 385, 66, 63, 68, 54, 395, 58, 62, 128, 52, 144, 55, 55, 58, 59, 161, 105, 348, 50, 51, 52, 67, 52, 51, 53, 54, 58, 50, 53, 66, 66]
第99次随机:[90, 93, 206, 53, 71, 58, 329, 61, 71, 56, 55, 57, 131, 87, 95, 74, 291, 58, 66, 371, 56, 147, 116, 59, 50, 67, 149, 228, 51, 61, 54, 67, 63, 54, 66, 60, 71, 170, 58, 55, 69, 103, 130, 190, 51, 61, 79, 51, 121, 70]
第100次随机:[133, 120, 61, 72, 59, 63, 61, 53, 62, 54, 74, 76, 379, 71, 399, 138, 94, 52, 99, 53, 50, 68, 57, 61, 125, 214, 53, 54, 71, 66, 62, 65, 146, 63, 64, 61, 146, 64, 96, 143, 129, 66, 56, 61, 57, 133, 147, 149, 150, 150]
最小值50平均出现次数:1
大区间值150~400平均出现次数:6,即一次红包队列分配结果中平均出现6份红包位于大区间范围150~400内
View Code

  至此本次红包算法改造已完成,已满足产品需求。