private static void Main() { var seed = new ChaCha.Seed(new UInt32[] { 1, 2, 3, 4, 5, 6, 7, 8 }); var rng = ChaCha.Create(seed); var stopwatch = Stopwatch.StartNew(); (Double pi, Double error) = EstimatePi(rng); stopwatch.Stop(); Console.WriteLine($"Pi: {pi}, error: {error}, time (sec): {stopwatch.Elapsed.TotalSeconds}"); }
public RngUInt32() { _chaCha8 = ChaCha.GetChaCha8Factory().Create(new ChaCha.Seed()); _chaCha12 = ChaCha.GetChaCha12Factory().Create(new ChaCha.Seed()); _chaCha20 = ChaCha.GetChaCha20Factory().Create(new ChaCha.Seed()); _pcg32 = Rngs.Pcg32.Create(0, 0); _mt1993764 = Rngs.Mt1993764.Create(0); _xorShift = Rngs.XorShift.Create(1, 1, 1, 1); _systemCryptoRng = Rngs.SystemCryptoRng.Create(); #pragma warning disable CS0618 _cryptoServiceProvider = Rngs.CryptoServiceProvider.Create(); #pragma warning restore CS0618 _random = new Random(42); }
public ChaChaPresentationViewModel(ChaCha chaCha) { ChaCha = chaCha; ChaCha.PropertyChanged += new PropertyChangedEventHandler(OnPluginPropertyChanged); // Add available pages Pages.Add(new StartViewModel()); Pages.Add(new OverviewViewModel(this)); Pages.Add(new DiffusionViewModel(this)); Pages.Add(new StateMatrixInitViewModel(this)); Pages.Add(new ChaChaHashViewModel(this)); Pages.Add(new XorViewModel(this)); // Set starting page CurrentPage = Pages[0]; }
public ChaChaPresentation(ChaCha chachaVisualization) { InitializeComponent(); this.DataContext = new ChaChaPresentationViewModel(chachaVisualization); }
private StandardRng(ChaCha wrapped) => _wrapped = wrapped;