Reference types, Value types, and Patterns
- slide 26 : 29
A Singleton Random Class
Earlier in this lecture we had a problem with one Random object per Die object
The original Die example
Dice and Random objects
A singleton Random class.
A Die class that uses singleton Random.
A Die application class.
Output from the Die application class.
By using a Singleton Random we ensure that there exists only one Random object
MSDN: Implementing Singleton in C#