RandomModule

The RandomModule class enables random number generation.

Example

//==============================================================================
// The following example demonstrates how to generate a random number and use it
// to change the scale of an object.
//
// Project setup:
// - Insert a plane
//==============================================================================

// Load in the required modules
const Random = require('Random');
const Scene = require('Scene');

// Locate the plane in the Scene
const plane = Scene.root.find('plane0');

// Store a random number
const randomNum = Random.random();

// Bind the random number to the x-axis scale signal of the plane
plane.transform.scaleX = randomNum;

Properties

This module exposes no properties.

Methods

Method

Description

random

random(): number

Returns a uniformly distributed number between 0.0 (inclusive) and 1.0 (exclusive).

Classes

This module exposes no classes.

Last updated