RLS Studios
ProjectsPatreonCommunityDocsAbout
Join Patreon
BeamNG Modding Docs

Guides

Reference

Server CommandsGE UtilitiesGame Engine MainNavigation GraphScreenshot CaptureServerServer ConnectionSpawnpoint ManagerSimulation TimeVehicle SpawningSuspension Frequency Tester
Flowgraph Base ModuleFlowgraph Base NodeFlowgraph Base State NodeFlowgraph Node BuilderFlowgraph GraphFlowgraph Group HelperFlowgraph LinkFlowgraph ManagerNew Node TemplateFlowgraph PinFlowgraph States ManagerFlowgraph UtilsFlowgraph Variable Storage
Route Distance (Flowgraph Node)Closest Road (Flowgraph Node)Custom Lua (Flowgraph Node)Distance Between (Flowgraph Node)Waypoints Distance (Flowgraph Node)File Exists (Flowgraph Node)Get First Element of Table (Flowgraph Node)Get Level Data (Flowgraph Node)Get Map Objects IDs by DynField (Flowgraph Node)Get Table Value By Key (Flowgraph Node)GHOST (Flowgraph Node)Hide Loading Screen (Flowgraph Node)Color HSV (Flowgraph Node)Line Point From Xnorm (Flowgraph Node)Load Level (Flowgraph Node)Load Project (Flowgraph Node)On Menu (Flowgraph Node)Perlin Noise (Flowgraph Node)Pop Action Map (Flowgraph Node)Get Project InfoPush Action MapRandom ColorRandom NumberRandom QuaternionRandom VectorRoad PropertiesGet Navgraph RouteRoute PositionTemplate NodeTimeTimed SequenceTo NumberTo StringWorld Editor Open

UI

Resources

BeamNG Game Engine Lua Cheat SheetGE Developer RecipesMCP Server Setup

// RLS.STUDIOS=true

Premium Mods for BeamNG.drive. Career systems, custom vehicles, and immersive gameplay experiences.

Index

HomeProjectsPatreon

Socials

DiscordPatreon (RLS)Patreon (Vehicles)

© 2026 RLS Studios. All rights reserved.

Modding since 2024

API ReferenceGE Extensionsflowgraphnodesutil

Random Number

- **Node Name:** `Random Number`

Overview

  • Node Name: Random Number
  • Category: repeat_instant
  • File: extensions/flowgraph/nodes/util/randomNumber.lua

Outputs a random number within a specified range each frame it receives flow. Supports both integer and floating-point output.

Pin Schema

Input Pins

PinTypeDefaultDescription
rangeStartnumber0The smallest number in the range (hardcoded)
rangeEndnumber10The biggest number in the range (hardcoded)
floatboolfalseIf enabled, output is a float; otherwise integer (hidden, hardcoded)

Output Pins

PinTypeDescription
randomnumberThe generated random number

Internals

Key Methods

MethodDescription
work()Generates a random number between rangeStart and rangeEnd each frame

Random Generation Logic

  • Integer mode (default): Uses math.random(rangeStart, rangeEnd) for whole numbers.
  • Float mode: Computes rangeStart + math.random() * (rangeEnd - rangeStart) for continuous values.
  • Fallback: If start/end are nil, returns math.random() (0 to 1).

How It Works

  1. Each frame, work() checks if rangeStart and rangeEnd are provided.
  2. Based on the float pin, selects integer or floating-point random generation.
  3. Outputs the result on the random pin.
  4. Since the category is repeat_instant, a new random number is generated every frame.

Usage Example

-- Integer random between 1 and 100:
-- rangeStart = 1, rangeEnd = 100, float = false
-- Output: 42 (varies each frame)

-- Float random between 0.0 and 1.0:
-- rangeStart = 0, rangeEnd = 1, float = true
-- Output: 0.73521... (varies each frame)

-- No range specified:
-- Both pins nil → output is math.random() (0 to 1)

Key Dependencies

  • math.random() - Lua standard library random number generation

See Also

  • Route Distance (Flowgraph Node) - Related reference
  • Closest Road (Flowgraph Node) - Related reference
  • Custom Lua (Flowgraph Node) - Related reference
  • FlowGraph Guide - Guide

Random Color

- **Node Name:** `Random Color`

Random Quaternion

- **Node Name:** `Random Quaternion`

On this page

OverviewPin SchemaInput PinsOutput PinsInternalsKey MethodsRandom Generation LogicHow It WorksUsage ExampleKey DependenciesSee Also