random

package
v0.0.0-...-6e72cc2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 11, 2023 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package random contains core and general purpose functionalities for the randomizer.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Id

type Id uint16

An Id represents the ID of an in-game entity. Its value is the integer representation of its original hex value.

func NewId

func NewId(source int) (Id, error)

NewId creates a new Id with the given integer as its value. If the given integer is not in the range of valid IDs then an error will be returned.

func RandomId

func RandomId(seed Seed, min, max Id) (Id, error)

RandomId creates a new random Id using a certain Seed within the given Id range (inclusive).

type Randomizer

type Randomizer interface {
	Randomize() error
}

A Randomizer implements the logic to randomize a certain game entity.

type Seed

type Seed struct {
	// contains filtered or unexported fields
}

A Seed represents the seed of a whole randomizer process to guarantee reproducible randomization results.

func NewSeed

func NewSeed() Seed

NewSeed creates a new Seed based on the current time.

func SeedFrom

func SeedFrom(source string) Seed

SeedFrom creates a new Seed based on the given string's checksum.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL