FlipperDotNet.Gate.PercentageOfTimeGate.IsOpen C# (CSharp) Méthode

IsOpen() public méthode

public IsOpen ( object thing, object value, string featureName ) : bool
thing object
value object
featureName string
Résultat bool
        public bool IsOpen(object thing, object value, string featureName)
        {
            var percentage = (int) value;
            return _random.NextDouble() < (percentage / 100.0);
        }

Usage Example

 public bool IsOpen(int seed, int percentage)
 {
     var random = new Random(seed);
     var gate = new PercentageOfTimeGate(random);
     return gate.IsOpen(null, percentage, "Feature");
 }