This reference is for Processing 2.0+. If you have a previous version, use the reference included with your software. If you see any errors or have suggestions, please let us know. If you prefer a more technical reference, visit the Processing Javadoc.
Class | PVector |
Name |
random2D() |
Examples |
PVector v;
void setup() {
v = PVector.random2D();
println(v);
// May print something like:
// [ -0.75006354, -0.6613658, 0.0 ] or
// [ 0.13742635, 0.990512, 0.0 ] or
// [ -0.9456181, -0.32527903, 0.0 ]
}
|
Description |
Returns a new 2D unit vector with a random direction. If you pass in this as an argument, it will use the PApplet's random number generator.
|
Syntax | .random2D()
.random2D(parent)
.random2D(target)
.random2D(target, parent) |
Parameters |
parent |
PApplet: current PApplet instance |
target |
PVector: the target vector (if null, a new vector will be created) |
|
Returns | PVector |
Related | random3D()
|
Updated on May 19, 2014 05:30:03pm PDT