Lecture overview -- Keyboard shortcut: 'u'  Previous page: The Singleton pattern -- Keyboard shortcut: 'p'  Next page: Factory methods -- Keyboard shortcut: 'n'  Lecture notes - all slides together  Annotated slide -- Keyboard shortcut: 't'  Alphabetic index  Help page about these notes  Course home    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
RandomSingleton.cs
A singleton Random class.
die.cs
A Die class that uses singleton Random.
dieApp.cs
A Die application class.
output
Output from the Die application class.
By using a Singleton Random we ensure that there exists only one Random object