Skip to main content

vJSONRandom

Generate an array of random values between a low and a high limit, packed as X, X Y or X Y Z entries.

BeginnerMograph / JSONJSONArrayScriptVal
vJSONRandom node

vJSONRandom has no input and outputs an array of random entries. Array length sets the number of entries, Pack To sets how many values each entry holds, and the Low and High range sets the limits.

Parameters​

ParameterTypeDefaultDescription
Array lengthInteger2Number of entries in the output. Minimum 2, default 2.
LowFloat-1Lower end of the range the values are drawn from. Default -1.
HighFloat1Upper end of the range the values are drawn from. Default 1.
MultiplyFloat0Hidden control. It is read by the node but has no effect on the output. Default 0.
SeedInteger0Seed of the random generator. Default 0.
+1 more parameters
ParameterTypeDefaultDescription
Pack To:DropdownX Y ZNumber of values in each entry, X, X Y or X Y Z. Default X Y Z.
Read the full description

The node seeds Lua's random generator with Seed and writes Array length entries. Every value is drawn from a uniform distribution between Low and High. The same Seed gives the same output.

Pack To selects the entry size: X gives one value per entry, X Y gives two and X Y Z gives three. The same Low and High apply to every value in an entry. With the defaults (Array length 2, Low -1, High 1, X Y Z) the node outputs two entries of three values each, so it can be used directly as XYZ points.

Array length has a minimum of 2. Seed is a whole number from a slider with a displayed range of -100 to 100 and no limit in the code. Use vJSONMinMax if each value needs its own range.

Example Connections​

vJSONRandom.Output -> vJSONCameraProjection.ArrayA
vJSONCameraProjection.Output -> vJSONShapeRender.ArrayPoint
Background.Output -> vJSONShapeRender.Input