Image

Imagevalera wrote in Imagejava_dev

Listens: Ofra Haza - Jerusalem of Gold

multiple object overhead

I'm writing a Deck class for a card game. So far, 2 methods of the class use the random number generator.
Question: Should I make the Random object an instance variable of the class so that all methods have access to it, or should I create separate Random objects for each method that needs them? What are the pros and cons?

Thanks.