Currently, I have an immutable type with a name Genethat has only 2 fields:
double value;
Interval intervalOfAllowedValues;
I sometimes need to Generandomly switch its value to some other value while it is still in the range defined in intervalOfAllowedValues.
I made a special method for this
public Gene RandomMutation() { ... }
who will take care of this situation using INumberGenerator.GenerateDouble(...). The problem is that it either RandomMutation()takes an argument IRandomNumberGenerator, or Genemust take one by injecting a constructor.
None of the solutions are to your liking:
RandomMutation() , , Gene INumberGenenerator, , .
, , a INumberGenerator Gene, , , . , Gene .
, 2 Gene, . , ?
: RandomMutation() Gene. , , Gene, Gene, Interval, . , , , .
4- (!) : (Singleton). , .
?