--- generated_by: gdlink-build generated_at: 2026-06-23T12:34:28Z do_not_edit: true title: Random brick_type: executor tier: Basic generated: true --- # Random **Category:** Executor **Tier:** Basic ## Purpose Generates random values and stores them in variables. ## Visual Reference ```{raw} html
As added to your scene
Random brick as it appears in the GDLink editor
``` ## When To Use **1. Random Damage** ``` Keyboard Listener (Key: "Space") -> AND Gate -> Random Executor (Integer, Min: 20, Max: 30, Target: Local "damage_dealt") -> Property Executor (Set Global "enemy_health" -= Local "damage_dealt") ``` Deal 20-30 random damage. **2. Random Loot Drop** ``` Collision Listener (Group: "enemies") -> Property Listener (Global "enemy_health" == 0) -> AND Gate -> Random Executor (Choice: "sword,shield,potion", Target: Local "drop_item") -> Edit Object Executor (Add: "res://items/" + Local "drop_item" + ".tscn") ``` Enemy drops random item on death. **3. Procedural Spawn Position** ``` Always Listener (Pulse: 2 seconds) -> AND Gate -> Random Executor (Float, Min: -10, Max: 10, Target: Local "spawn_x") -> Random Executor (Float, Min: -10, Max: 10, Target: Local "spawn_z") -> Edit Object Executor (Add: "res://enemy.tscn", Position: (Local "spawn_x", 0, Local "spawn_z")) ``` Spawn enemies at random XZ positions every 2 seconds. **4. Random Color Variation** ``` Message Listener (Subject: "spawn") -> AND Gate -> Random Executor (Color, Target: Local "color") -> Material Executor (Albedo Color: Local "color") ``` Each spawned object gets random color. **5. Dice Roll Mini-Game** ``` Keyboard Listener (Key: "R", Tap: true) -> AND Gate -> Random Executor (Integer, Min: 1, Max: 20, Target: Global "dice_roll") -> PRINT Executor ("You rolled: {dice_roll}") ``` Roll 20-sided die (D20). ## Runtime Behavior **Executes**: Generates a random value and stores it in specified variable ```{raw} html
Generated UI Mockup — showing expanded properties
Random
-
x
Name:
Label this brick...
Mode:
Integer Range
Min
1
v
Max
10
v
``` ## Properties | Property | Type | Default | Notes | |---|---|---|---| | Chance (%) | float | 50.0 | Probability of triggering (0-100%) each tick |