It depends. If the part of your program that works with RNG
consists of and will likely consist of (hard to see the future though) just those three functions, and those functions only need to work on one object - always the same, all the time-, then why not making that object global.
Avoid restricting a type to only have one instance (Singleton pattern) unless that is an inherent characteristic of that type. If your program uses only one instance of RNG
, then your program will just create one instance (i.e., make the object global, or constrain your program - not the type - to only create one instance). I can very well imagine that other libraries or programs may create several random generators.
Of course, if one day those functions will have to work on several different instances of RNG
(although one at a time), then you will need to let them take an instance of that class as a function argument, and let them work on that argument. Clients will have to take care of providing the appropriate instance of RNG
as an argument to those functions.
Then, if one day you will realize that those functions will also end up all working on other object types, and those data are somehow related to each other, you could consider wrapping them in a data structure or in a class, possibly making your functions member functions of that class - if the operation it carries out is fundamental for that type.
Giving guidelines in general without knowing what you have in mind, and what kind of application or library you are going to write, is not easy. Hopefully this helped a bit.