本文整理汇总了Java中org.andengine.util.math.MathUtils.random方法的典型用法代码示例。如果您正苦于以下问题:Java MathUtils.random方法的具体用法?Java MathUtils.random怎么用?Java MathUtils.random使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.andengine.util.math.MathUtils
的用法示例。
在下文中一共展示了MathUtils.random方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: determineCurrentRate
import org.andengine.util.math.MathUtils; //导入方法依赖的package包/类
protected float determineCurrentRate() {
if (this.mRateMinimum == this.mRateMaximum) {
return this.mRateMinimum;
} else {
return MathUtils.random(this.mRateMinimum, this.mRateMaximum);
}
}
示例2: getRandomValueC
import org.andengine.util.math.MathUtils; //导入方法依赖的package包/类
protected float getRandomValueC() {
if (this.mMinValueC == this.mMaxValueC) {
return this.mMaxValueC;
} else {
return MathUtils.random(this.mMinValueC, this.mMaxValueC);
}
}
示例3: getRandomValueB
import org.andengine.util.math.MathUtils; //导入方法依赖的package包/类
protected float getRandomValueB() {
if(this.mMinValueB == this.mMaxValueB) {
return this.mMaxValueB;
} else {
return MathUtils.random(this.mMinValueB, this.mMaxValueB);
}
}
示例4: determineCurrentRate
import org.andengine.util.math.MathUtils; //导入方法依赖的package包/类
protected float determineCurrentRate() {
if(this.mRateMinimum == this.mRateMaximum){
return this.mRateMinimum;
} else {
return MathUtils.random(this.mRateMinimum, this.mRateMaximum);
}
}
示例5: getRandomValue
import org.andengine.util.math.MathUtils; //导入方法依赖的package包/类
protected float getRandomValue() {
if (this.mMinValue == this.mMaxValue) {
return this.mMaxValue;
} else {
return MathUtils.random(this.mMinValue, this.mMaxValue);
}
}
示例6: LevelStatsDBConnector
import org.andengine.util.math.MathUtils; //导入方法依赖的package包/类
public LevelStatsDBConnector(final Context pContext, final String pSecret, final String pSubmitURL) {
this.mSecret = pSecret;
this.mSubmitURL = pSubmitURL;
final SharedPreferences simplePreferences = SimplePreferences.getInstance(pContext);
final int playerID = simplePreferences.getInt(PREFERENCES_LEVELSTATSDBCONNECTOR_PLAYERID_ID, -1);
if(playerID != -1) {
this.mPlayerID = playerID;
} else {
this.mPlayerID = MathUtils.random(1000000000, Integer.MAX_VALUE);
SimplePreferences.getEditorInstance(pContext).putInt(PREFERENCES_LEVELSTATSDBCONNECTOR_PLAYERID_ID, this.mPlayerID).commit();
}
}
示例7: random
import org.andengine.util.math.MathUtils; //导入方法依赖的package包/类
public static final byte random(final byte[] pArray) {
return pArray[MathUtils.random(0, pArray.length - 1)];
}
示例8: random
import org.andengine.util.math.MathUtils; //导入方法依赖的package包/类
public static final long random(final long[] pArray) {
return pArray[MathUtils.random(0, pArray.length - 1)];
}
示例9: random
import org.andengine.util.math.MathUtils; //导入方法依赖的package包/类
public static final short random(final short[] pArray) {
return pArray[MathUtils.random(0, pArray.length - 1)];
}
示例10: random
import org.andengine.util.math.MathUtils; //导入方法依赖的package包/类
public static final double random(final double[] pArray) {
return pArray[MathUtils.random(0, pArray.length - 1)];
}
示例11: push
import org.andengine.util.math.MathUtils; //导入方法依赖的package包/类
private void push (long insertKey, V insertValue, int index1, long key1, int index2, long key2, int index3, long key3) {
long[] keyTable = this.keyTable;
V[] valueTable = this.valueTable;
int mask = this.mask;
// Push keys until an empty bucket is found.
long evictedKey;
V evictedValue;
int i = 0, pushIterations = this.pushIterations;
do {
// Replace the key and value for one of the hashes.
switch (MathUtils.random(0, 2)) {
case 0:
evictedKey = key1;
evictedValue = valueTable[index1];
keyTable[index1] = insertKey;
valueTable[index1] = insertValue;
break;
case 1:
evictedKey = key2;
evictedValue = valueTable[index2];
keyTable[index2] = insertKey;
valueTable[index2] = insertValue;
break;
default:
evictedKey = key3;
evictedValue = valueTable[index3];
keyTable[index3] = insertKey;
valueTable[index3] = insertValue;
break;
}
// If the evicted key hashes to an empty bucket, put it there and stop.
index1 = (int)(evictedKey & mask);
key1 = keyTable[index1];
if (key1 == EMPTY) {
keyTable[index1] = evictedKey;
valueTable[index1] = evictedValue;
if (size++ >= threshold) resize(capacity << 1);
return;
}
index2 = hash2(evictedKey);
key2 = keyTable[index2];
if (key2 == EMPTY) {
keyTable[index2] = evictedKey;
valueTable[index2] = evictedValue;
if (size++ >= threshold) resize(capacity << 1);
return;
}
index3 = hash3(evictedKey);
key3 = keyTable[index3];
if (key3 == EMPTY) {
keyTable[index3] = evictedKey;
valueTable[index3] = evictedValue;
if (size++ >= threshold) resize(capacity << 1);
return;
}
if (++i == pushIterations) break;
insertKey = evictedKey;
insertValue = evictedValue;
} while (true);
putStash(evictedKey, evictedValue);
}