| Package | com.yworks.yfiles.util |
| Class | public class YRandom |
| Inheritance | YRandom Random YObject Object |
| Method | Defined By | ||
|---|---|---|---|
YRandom(init:Boolean = true)
Creates a new instance of this class. | YRandom | ||
![]() | equals(o:Object):Boolean | YObject | |
getBoolArray(n:int, trueCount:int):Vector.<Boolean>
Returns an array of n randomly chosen boolean values of which trueCount of them are true. | YRandom | ||
getClass():Class [override] | YRandom | ||
getIntArray(bucketCount:int, ballCount:int):Vector.<int>
Returns an int array of length bucketCount for which the values of all fields are non-negative and sum up to ballCount. | YRandom | ||
getUniqueArray(n:int, min:int, max:int):Vector.<int>
Returns an array of n unique random integers that lie within the range min (inclusive) and max (exclusive). | YRandom | ||
![]() | hashCode():int | YObject | |
![]() | [static]
Construct a random generator with the current time of day in milliseconds
as the initial state. | Random | |
![]() | [static]
Construct a random generator with the given seed as the initial state. | Random | |
[static]
Creates a new instance of this class. | YRandom | ||
[static]
Creates a new instance of this class with a given initial random seed. | YRandom | ||
![]() | nextBoolean():Boolean
Answers the next pseudo-random, uniformly distributed boolean value generated by this generator. | Random | |
![]() | nextBytes(buf:Vector.<int>):void
Modifies the byte array by a random sequence of bytes generated by this random number generator. | Random | |
![]() | nextDouble():Number
Generates a normally distributed random double number between 0.0 inclusively and 1.0 exclusively. | Random | |
nextDoubleInRange(minValue:Number, maxValue:Number):Number
Returns a double with a random value between minValue (inclusive) and maxValue (exclusive). | YRandom | ||
![]() | nextFloat():Number
Generates a normally distributed random float number between 0.0 inclusively and 1.0 exclusively. | Random | |
![]() | nextGaussian():Number
Returns a pseudo-randomly generated, normally distributed double value with mean 0.0 and a standard deviation value of 1.0. | Random | |
![]() | nextInt():int
Generates a uniformly distributed 32-bit int value from the this random number sequence. | Random | |
nextInt2(n:int):int [override]
Returns a pseudo-random, uniformly distributed int value between 0 (inclusive) and the specified value (exclusive), drawn from this random number generator's sequence. | YRandom | ||
nextIntInRange(minValue:int, maxValue:int):int
Returns an int with a random value between minValue (inclusive) and maxValue (exclusive). | YRandom | ||
![]() |
Generates a uniformly distributed 64-bit int value from the this random
number sequence. | Random | |
permutate(a:Vector.<Object>):void
Permutes the positions of the elements within the given array. | YRandom | ||
| Method | Defined By | ||
|---|---|---|---|
![]() | initRandom1():void
Initializes this object. | Random | |
![]() | initRandom2(seed:LongImpl):void
Initializes this object. | Random | |
initYRandom1():void
Initializes this object. | YRandom | ||
initYRandom2(seed:LongImpl):void
Initializes this object. | YRandom | ||
![]() | next(bits:int):int
Returns a pseudo-random uniformly distributed int value of the number of bits specified by the argument bits. | Random | |
| YRandom | () | Constructor |
public function YRandom(init:Boolean = true)Creates a new instance of this class.
Parametersinit:Boolean (default = true) — An internally used switch to help handle proper instance initialization in inheritance chains where classes can have multiple constructor-like factory methods.
This parameter can safely be ignored/omitted when calling the constructor.
|
| getBoolArray | () | method |
public function getBoolArray(n:int, trueCount:int):Vector.<Boolean>
Returns an array of n randomly chosen boolean values of which trueCount of them are true.
If the requested numbers of true values is bigger than the number of requested boolean values, an Exception is raised.
Parameters
n:int | |
trueCount:int |
Vector.<Boolean> |
| getClass | () | method |
override public function getClass():ClassReturnsClass |
| getIntArray | () | method |
public function getIntArray(bucketCount:int, ballCount:int):Vector.<int>
Returns an int array of length bucketCount for which the values of all fields are non-negative and sum up to ballCount.
The values are put in the array randomly.
Parameters
bucketCount:int | |
ballCount:int |
Vector.<int> |
| getUniqueArray | () | method |
public function getUniqueArray(n:int, min:int, max:int):Vector.<int>
Returns an array of n unique random integers that lie within the range min (inclusive) and max (exclusive).
If max - min < n then null is returned.
Parameters
n:int | |
min:int | |
max:int |
Vector.<int> |
| initYRandom1 | () | method |
protected final function initYRandom1():void
Initializes this object. See the documentation of the corresponding factory method newYRandom1() for details.
See also
| initYRandom2 | () | method |
protected final function initYRandom2(seed:LongImpl):void
Initializes this object. See the documentation of the corresponding factory method newYRandom2() for details.
Parameters
seed:LongImpl |
See also
| newYRandom1 | () | method |
| newYRandom2 | () | method |
public static function newYRandom2(seed:LongImpl):YRandomCreates a new instance of this class with a given initial random seed.
Parameters
seed:LongImpl |
YRandom |
| nextDoubleInRange | () | method |
public function nextDoubleInRange(minValue:Number, maxValue:Number):Number
Returns a double with a random value between minValue (inclusive) and maxValue (exclusive).
Precondition maxValue > minValue
Parameters
minValue:Number | |
maxValue:Number |
Number |
| nextInt2 | () | method |
override public function nextInt2(n:int):intReturns a pseudo-random, uniformly distributed value between 0 (inclusive) and the specified value (exclusive), drawn from this random number generator's sequence.
Parameters
n:int |
int |
| nextIntInRange | () | method |
public function nextIntInRange(minValue:int, maxValue:int):int
Returns an int with a random value between minValue (inclusive) and maxValue (exclusive).
Precondition maxValue > minValue
Parameters
minValue:int | |
maxValue:int |
int |
| permutate | () | method |
public function permutate(a:Vector.<Object>):voidPermutes the positions of the elements within the given array.
Parameters
a:Vector.<Object> |