Download data/DWSIM.Math.RandomOps/Switcher.cs from introvoyz041/Dwsim: direct link, hf CLI and curl.
- Browser
- Download file 1.89 kB
-
https://huggingface.co/datasets/introvoyz041/Dwsim/resolve/main/data/DWSIM.Math.RandomOps/Switcher.cs
- Command line
-
hf download hf://datasets/introvoyz041/Dwsim/data/DWSIM.Math.RandomOps/Switcher.cs
-
curl -L -o Switcher.cs https://huggingface.co/datasets/introvoyz041/Dwsim/resolve/main/data/DWSIM.Math.RandomOps/Switcher.cs
1.89 kB
| /// ------------------------------------------------------ | |
| /// RandomOps - (Pseudo) Random Number Generator For C# | |
| /// Copyright (C) 2003-2010 Magnus Erik Hvass Pedersen. | |
| /// Please see the file license.txt for license details. | |
| /// RandomOps on the internet: http://www.Hvass-Labs.org/ | |
| /// ------------------------------------------------------ | |
| namespace RandomOps | |
| { | |
| /// <summary> | |
| /// Randomly switch between different RNGs. | |
| /// Thread-safe if RNGs are thread-safe. | |
| /// </summary> | |
| /// <remarks> | |
| /// This basically just implements the SelectRand() method | |
| /// from the RandMulti-class. | |
| /// </remarks> | |
| public class Switcher : Multi | |
| { | |
| /// <summary> | |
| /// Constructs the RNG-object from other RNGs. | |
| /// </summary> | |
| /// <param name="randSwitch">The RNG that will be used to determine switching.</param> | |
| /// <param name="rands">The RNGs to switch between.</param> | |
| public Switcher(Random randSwitch, Random[] rands) | |
| : base(rands) | |
| { | |
| RandSwitch = randSwitch; | |
| } | |
| /// <summary> | |
| /// The RNG used to determine when to switch. | |
| /// </summary> | |
| Random RandSwitch; | |
| /// <summary> | |
| /// Name of the RNG. | |
| /// </summary> | |
| public override string Name | |
| { | |
| get { return "Switcher-" + base.Name; } | |
| } | |
| /// <summary> | |
| /// Determine which RNG in RandMulti to use. | |
| /// </summary> | |
| /// <returns>Index for the RNG.</returns> | |
| protected override int SelectRand() | |
| { | |
| return RandSwitch.Index(base.Rands.Length); | |
| } | |
| } | |
| } | |