import 'dart:math' as math;

import 'package:ecosim/src/ecosim/utils.dart';

// Abstract class that defines the base that
// any DNA object should have
abstract class Dna {
  const Dna({required this.mutationThreshold});
  final double mutationThreshold;

  double getRandMutationDelta() {
    final rng = math.Random();
    if (rng.getRandomDoubleInRange(0.0, 1.0) > mutationThreshold) {
      if (rng.getRandomDoubleInRange(0.0, 1.0) > 0.5) {
        return 0.1;
      } else {
        return -0.1;
      }
    } else {
      return 0.0;
    }
  }
}
