Skip to content

Modern Math RngFromEntropy

Paul Squires edited this page Oct 12, 2026 · 5 revisions

Home › Math Library › Math Library › RngFromEntropy

RngFromEntropy

Syntax

RngFromEntropy( )

Examples

#import "std/numeric"
using numeric

'' A generator seeded from the OS entropy source, so two runs differ.
'' Rng( seed ) is the reproducible alternative.
dim r as Rng = RngFromEntropy( )

dim as int64 lo = 1, hi = 6
dim as int64 roll = r.NextInt( lo, hi )
print roll >= 1 andalso roll <= 6         '' -1 (true)

'' Seed it explicitly when a test has to be reproducible

Library: Math Library
Category: Math Library
Documented under: Nothing Becomes A Keyword
Source: docs/math/math.txt in the FBC-Modern repository.

Clone this wiki locally