当前位置: 首页>>代码示例>>Java>>正文


Java MersenneTwisterFast.nextBoolean方法代码示例

本文整理汇总了Java中ec.util.MersenneTwisterFast.nextBoolean方法的典型用法代码示例。如果您正苦于以下问题:Java MersenneTwisterFast.nextBoolean方法的具体用法?Java MersenneTwisterFast.nextBoolean怎么用?Java MersenneTwisterFast.nextBoolean使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ec.util.MersenneTwisterFast的用法示例。


在下文中一共展示了MersenneTwisterFast.nextBoolean方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: DEFAULT_RANDOM_STEP

import ec.util.MersenneTwisterFast; //导入方法依赖的package包/类
final public static RandomStep<SeaTile> DEFAULT_RANDOM_STEP(int maxStep,int attempts){
    return new RandomStep<SeaTile>() {
        @Override
        public SeaTile randomStep(
                FishState state, MersenneTwisterFast random, Fisher fisher, SeaTile current)
        {
            for(int i=0; i<attempts; i++)
            {
                int x = current.getGridX() + (random.nextBoolean() ? random.nextInt(maxStep+1) : -random.nextInt(maxStep+1));
                int y = current.getGridY() + (random.nextBoolean() ? random.nextInt(maxStep+1) : -random.nextInt(maxStep+1));
                SeaTile candidate = state.getMap().getSeaTile(x,y);
                if(candidate!=null && current!= candidate && candidate.getAltitude()<0
                        &&!fisher.getHomePort().getLocation().equals(candidate) )
                    return candidate;
            }

            //stay where you are
            return current;
        }
    };
}
 
开发者ID:CarrKnight,项目名称:POSEIDON,代码行数:22,代码来源:DefaultBeamHillClimbing.java

示例2: shouldFisherLeavePort

import ec.util.MersenneTwisterFast; //导入方法依赖的package包/类
/**
 * The fisher asks himself if he wants to leave the warm comfort of his bed.
 *
 *  @param fisher
 * @param model the model. Not used  @return true if the fisherman wants to leave port.
 * @param random */
@Override
public boolean shouldFisherLeavePort(
        Fisher fisher, FishState model, MersenneTwisterFast random) {
    if(checkOnlyOnceADay && model.getDay()==dayLastCheck) //if you already checked don't bother
        return false;
    dayLastCheck = model.getDay();
    return random.nextBoolean(probabilityToLeavePort);
}
 
开发者ID:CarrKnight,项目名称:POSEIDON,代码行数:15,代码来源:FixedProbabilityDepartingStrategy.java

示例3: test

import ec.util.MersenneTwisterFast; //导入方法依赖的package包/类
/**
 * returns true or false with probability given by the logistic
 * @param agent the agent making the choice
 * @param testTime the hours since start of simulation at which point we want the test to be made
 * @param model the model being used
 * @param tile the tile we are considering (can be null)
 * @param random the randomizer
 * @return true or false
 */
public boolean test(
        Fisher agent, final double testTime, FishState model, SeaTile tile, MersenneTwisterFast random){

    return random.nextBoolean(getProbability(agent, testTime, model, tile));
}
 
开发者ID:CarrKnight,项目名称:POSEIDON,代码行数:15,代码来源:LogisticClassifier.java


注:本文中的ec.util.MersenneTwisterFast.nextBoolean方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。