public void Diffuse() { var id = (ModelParameters.ModelTypeIndex + rand.Next(ModelRepository.PrototypeCount)) % ModelRepository.PrototypeCount; ModelParameters.ModelTypeIndex = id; var angle = ModelParameters.Angle + rand.Next(-15, +15 + 1); ModelParameters.Angle = (short)angle; var scale = ModelParameters.Scale + rand.Next(-15, +15 + 1); ModelParameters.Scale = (short)scale; ModelParameters = ModelRepository.GetMostSimilarTo(ModelParameters); var template = ModelParameters.TryGetTemplate(); this.updateTemplateData(template); }