本文整理匯總了Java中processing.core.PApplet.random方法的典型用法代碼示例。如果您正苦於以下問題:Java PApplet.random方法的具體用法?Java PApplet.random怎麽用?Java PApplet.random使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類processing.core.PApplet
的用法示例。
在下文中一共展示了PApplet.random方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: subdivideNoisyLineSegment
import processing.core.PApplet; //導入方法依賴的package包/類
void subdivideNoisyLineSegment(PApplet ap,ArrayList<PVector> pts,
PVector A, PVector B, PVector C, PVector D, int minLength)
{
if(PVector.sub(A, C).mag() < minLength || PVector.sub(B, D).mag() < minLength)
return;
float p = ap.random(0.2f, 0.8f);
float q = ap.random(0.2f, 0.8f);
PVector E = lerpVector(A, D, p);
PVector F = lerpVector(B, C, p);
PVector G = lerpVector(A, B, q);
PVector I = lerpVector(D, C, q);
PVector H = lerpVector(E, F, q);
subdivideNoisyLineSegment(ap,pts, A, G, H, E, minLength);
pts.add(H);
subdivideNoisyLineSegment(ap,pts, H, F, C, I, minLength);
}
示例2: randomColor
import processing.core.PApplet; //導入方法依賴的package包/類
private static Color randomColor(PApplet ap)
{
if(ap != null)
return new Color(ap.random(1), ap.random(1), ap.random(1));
else
{
return new Color(alternateRand.nextFloat(),alternateRand.nextFloat(), alternateRand.nextFloat());
}
}
示例3: createRandomPointAround
import processing.core.PApplet; //導入方法依賴的package包/類
PVector createRandomPointAround(PApplet ap, PVector p, float minDist, float maxDist)
{
float a,r;
if(ap != null)
{
a = ap.random(2 * PApplet.PI);
r = ap.random(minDist, maxDist);
}
else
{
a = alternateRandomRange(0,2 * PApplet.PI);
r = alternateRandomRange(minDist, maxDist);
}
return new PVector(p.x + r * PApplet.cos(a), p.y + r * PApplet.sin(a));
}
示例4: createMap
import processing.core.PApplet; //導入方法依賴的package包/類
void createMap(PApplet ap, int seed) {
mapSeed = seed;
if(ap != null)
{
ap.randomSeed(seed);
ap.noiseSeed(seed);
landMassFraction = ap.random(landMassFractionMin, landMassFractionMax);
}
created = false;
creationStep = 0;
}