Skip to content

GRandom

googer_ edited this page Nov 13, 2024 · 2 revisions

About GRandom

GRandom is a library that generates RNG objects. These objects provide support for seeded generation of floats and ints

Capability random

Info

  • ID: alt text random
  • Accessed with: thorium.grandom

Functions

GRandom.New(seed: integer) -> Random
Creates new Random object


Class Random

alt text Random.New(self: Random, seed: integer) -> Random
Creates new Random object

alt text Random.GetSeed(self: Random) -> number
Get seed of Random object

alt text Random.SetSeed(self: Random, seed: integer) -> self: Random
Set seed on Random object

alt text Random.RandFloat(self: Random, min: number, max: number) -> number
Generates random float in range from min to max
When max is not set, min argument becomes the max, and min is set to 0
When no arguments are specified, min becomes 0, max becomes 1

alt text Random.RandInt(self: Random, min: number, max: number) -> number
Generates random integer in range from min to max
When max is not set, min argument becomes the max, and min is set to 0
When no arguments are specified, min becomes 0, max becomes 1

alt text Random.RandomFloat(self: Random) -> number
Generates random number in range from 0 to 1

Clone this wiki locally