zoukankan      html  css  js  c++  java
  • 一些常用的随机实现

    if (RandomUtil.randomInt(10) > 2)
    {
    // 1.高频
    }else if (RandomUtil.randomInt(10) > 3)
    {
    // 2
    } else if (RandomUtil.nextBoolean())
    {

    }


    int result = RandomUtil.randomInt(3);
    switch (result)
    {
    case 0:
    //搜索帮派
    csGuildSearch();
    break;
    case 1:
    //请求帮派列表和申请帮派
    csGuildList();
    break;
    case 2:
    //创建帮派
    csGuildCreate(getClientObject().getActorID());
    break;
    default:
    break;
    }



    int rankId = 0;
    int[] keys = DictRankDetailData.getServerTypeKeys();
    if (keys.length > 0)
    {
    int random1 = RandomUtil.randomInt(keys.length);
    TIntArrayList records = DictRankDetailData.getRecordsByServerType(keys[random1]);
    int randomRankIndex = RandomUtil.randomInt(records.size());
    if (randomRankIndex > 0)
    {
    rankId = records.get(randomRankIndex);
    }
    }

  • 相关阅读:
    架构设计
    第七章
    第六章
    第五章
    第四章
    第三章
    第二章
    第一章
    链表中环
    实现链表中的部分翻转
  • 原文地址:https://www.cnblogs.com/lizb0907/p/10067601.html
Copyright © 2011-2022 走看看