Skip to content

yachris/SRandom-for-Fantom

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Licensed under the Academic Free License version 3.0

This is a set of classes that behave like the existing “Int.random” and “Float.random”.

In fact, the “Unseedeed” variant just delegates to those very methods.

The “Seeded” variant allows setting the random number seed; this is so that you can get
a predictable, repeatable stream of random numbers. This is useful for testing and some
kinds of simulation.

The basic usage is:

generator := SRandom.instance // This returns the unseeded generator

or

seededGenerator := SRandom.instance(SRandomStrategy.SeededGenerator) // This returns the seeded generator

See the “SRandomExamples” class in the “examples” directory for a fuller use and explanation.

PERFORMANCE NOTE: The seeded generator is much slower than the unseeded generator, due (I think)
to its usage of an Actor instance to hide the java.util.Random instance it uses.

About

A seedable random number generator for the Fantom language (fantom.org)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published