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


Java Uniform.staticNextDouble方法代码示例

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


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

示例1: uniform_rnd

import cern.jet.random.Uniform; //导入方法依赖的package包/类
public static double uniform_rnd() {
	return Uniform.staticNextDouble();
}
 
开发者ID:seqcode,项目名称:seqcode-core,代码行数:4,代码来源:StatUtil.java

示例2: multinomial_rnd

import cern.jet.random.Uniform; //导入方法依赖的package包/类
public static int multinomial_rnd(double[] p, int vSize) {
	double sum = 0.0;
	double mass = 0.0;
	int cc = 0;
	int i = 0;
	
	for (i=0;i<vSize;i++) {
		sum += p[i];
	}
	
	mass = Uniform.staticNextDouble() * sum;
	
	i = 0;
	while (true) {
		mass -= p[i];
		if (mass <= 0.0) break;
		i++;
		cc++;
	}
	return cc;
}
 
开发者ID:seqcode,项目名称:seqcode-core,代码行数:22,代码来源:StatUtil.java

示例3: testDenseDoubleMatrix1D

import cern.jet.random.Uniform; //导入方法依赖的package包/类
@Test
public void testDenseDoubleMatrix1D()
{
    DenseDoubleMatrix1D a = new DenseDoubleMatrix1D(new double[]{
            Uniform.staticNextDouble(),Uniform.staticNextDouble(),Uniform.staticNextDouble()
    });
    
    DenseDoubleMatrix1D b = new DenseDoubleMatrix1D(new double[]{
            Uniform.staticNextDouble(),Uniform.staticNextDouble(),Uniform.staticNextDouble()
    });
    
    DoubleMatrix1D c = a.copy();
    
    FeatureCache cache = new FeatureCache(10);
    cache.put(a, null);
    
    assertTrue(cache.containsKey(a));
    assertFalse(cache.containsKey(b));
    assertTrue(cache.containsKey(c));
}
 
开发者ID:ieugen,项目名称:Teachingbox,代码行数:21,代码来源:TestFeatureCache.java

示例4: next

import cern.jet.random.Uniform; //导入方法依赖的package包/类
/**
 * Generate a number according to the given PDF.
 * Numbers start at 0 and end at PDF.length-1.
 * @return A number generated according to the PDF.
 */
public int next()
{
    int    pos;
    double sum, ran;
    
    // Pick a random index according to the PDF
    ran     = Uniform.staticNextDouble();
    pos     = 0;
    sum     = this.pk[0];
    //sum = 0 ;
    //System.out.println(" sum : " + sum ) ;
    while ( (sum < ran) && (pos < pk.length))
    {
       // sum += this.pk[pos];
    	//System.out.println(" pk : " + this.pk[pos] ) ;
    	pos++;
    	sum += this.pk[pos];
        
        // // pos++;
        //System.out.println("Ran : " + ran + " Pos : " + pos + " sum : " + sum ) ;
    }
    //pos-- ;
    // When running out of indices. Take the last one .     
    if (pos == pk.length) pos = pk.length-1;
    
    return(pos);
}
 
开发者ID:tchico,项目名称:dgMaster-trunk,代码行数:33,代码来源:PDFDiscrete.java

示例5: testCorrectValues

import cern.jet.random.Uniform; //导入方法依赖的package包/类
@Test
public static void testCorrectValues()
{
    double[] mu = new double[] {0,0};
    double[] sigma = new double[] {0.5,0.5};
    RadialBasisFunction rbf = new RadialBasisFunction(mu, sigma);
    
    for(int i=0; i<100; i++)
    {
        double[] x = new double[]{ Uniform.staticNextDouble(), Uniform.staticNextDouble() };
        assertEquals(rbf.getValue(x), correctFunction(x, mu, sigma), DELTA);
    }
}
 
开发者ID:ieugen,项目名称:Teachingbox,代码行数:14,代码来源:TestRadialBasisFunction.java

示例6: getAction

import cern.jet.random.Uniform; //导入方法依赖的package包/类
/**
 * Returns an action for every given state
 * With probability of epsilon selectedAction random action and with (1-epsilon)
 * the best action
 * @param s The state in which an action should be chosen
 * @param epsilon probability of taking selectedAction random action
 * @return The action to take in state s
 */
public Action getAction(final State state, double epsilon) {
    if( Uniform.staticNextDouble() < epsilon ) {
        final ActionSet validActions = actionSet.getValidActions(state);
        selectedAction = validActions.get( Uniform.staticNextIntFromTo(0,
                validActions.size()-1) );
        return selectedAction.copy();
    }

    return getBestAction(state);
}
 
开发者ID:ieugen,项目名称:Teachingbox,代码行数:19,代码来源:EpsilonGreedyPolicy.java

示例7: getValue

import cern.jet.random.Uniform; //导入方法依赖的package包/类
public double getValue(DoubleMatrix1D x) {
    if (Uniform.staticNextDouble() < super.getValue(x))
        return 1.0;
    return 0.0;
}
 
开发者ID:ieugen,项目名称:Teachingbox,代码行数:6,代码来源:ProbabilisticPlaceField.java


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