RandomService - UQcsse3200/2024-studio-1 GitHub Wiki

Overview

RandomService is a service that provides a random number generator for individual classes to use. This limits different class implementations using the same RNG, resulting in repeatable "random" code.

Using RandomService For Different Classes

After a RandomService is registered in ServiceLocator

ServiceLocator.registerRandomService(new RandomService("Default Seed :p"));

Classes obtain their specific RNG by calling

ServiceLocator.getRandomService().getRandomNumberGenerator(this.getClass());

Visual Representation

image