Skip to content
/ clr Public

(Charm Library Repository) A repository of Charm libraries.

License

Notifications You must be signed in to change notification settings

LyricLy/clr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

clr

(Charm Library Repository) A repository of Charm libraries.

Documentation

random

A simple linear congruential generator implementation of a random number generator.

The algorithm for a random number is x(n) = ((a * x(n-1)) + c) mod m. You can change the values of x, a, c and m with the functions seed, multiplier, increment and modulo, respectively. Each of these functions takes a single integer and sets the corresponding variable to that integer.

Call the random function to push a random number with these set variables. All of the variables are already predefined to values that will work, but for proper randomness try to seed the generator with environmental variables such as user input. The shuffle function takes a list and shuffles it randomly using the random function.

Until Charm is fixed, these functions will occasionally raise a floating point error. Try not to use a low number in the multiplier variable to minimize the chances of this.

sinclude

A simpler version of include that makes a few assumptions.

Takes a single string x and imports x.charm with the namespace x..

About

(Charm Library Repository) A repository of Charm libraries.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published