namespace InnovEnergy.Lib.Utils.Try; [Obsolete] public static class Policy { internal static Random Rng { get; } = new Random(); internal static TimeSpan ApplyJitter(this TimeSpan timeSpan, Double ratio) { return timeSpan * (1 - ratio + Rng.NextDouble() * 2 * ratio); } public static TrySync Try(Func func) { return new TrySync(func); } public static TrySync TryApply(this T t, Func func) { return new TrySync(() => func(t)); } public static TryAsync Try(Func> func) { return new TryAsync(func); } public static TryAsync TryApply(this T t, Func> func) { return new TryAsync(() => func(t)); } }