.. _doc_random_number_generation: Random number generation ======================== Many games rely on randomness to implement core game mechanics. This page guides you through common types of randomness and how to implement them in Godot. After giving you a brief overview of useful functions that generate random numbers, you will learn how to get random elements from arrays, dictionaries, and how to use a noise generator in GDScript. .. note:: Computers cannot generate "true" random numbers. Instead, they rely on `pseudorandom number generators ( https://en.wikipedia.org/wiki/Pseudorandom_number_generator )` (PRNGs). Global scope versus RandomNumberGenerator class ----------------------------------------------- Godot exposes two ways to generate random numbers: via *global scope* methods or using the `RandomNumberGenerator` class. Global scope methods are easier to set up, but they don't offer as much control. RandomNumberGenerator requires more code to use, but exposes many methods not found in global scope such as `randi_range()