/// <summary> /// Executes a pattern that has been loaded from a package using a custom random number generator and returns the resulting /// output. /// </summary> /// <param name="patternName">The name of the pattern to execute.</param> /// <param name="rng">The random number generator to use when generating output.</param> /// <param name="charLimit"> /// The maximum number of characters that can be printed. An exception will be thrown if the limit /// is exceeded. Set to zero or below for unlimited characters. /// </param> /// <param name="timeout">The maximum number of seconds that the pattern will execute for.</param> /// <param name="args">The arguments to pass to the pattern.</param> /// <returns></returns> public RantOutput DoName(string patternName, RNG rng, int charLimit = 0, double timeout = -1, RantProgramArgs args = null) { if (!ProgramNameLoaded(patternName)) { throw new ArgumentException(GetString("err-missing-pattern", patternName)); } return(RunVM(new Sandbox(this, _patternCache[patternName], rng, charLimit, GetPreservedCarrierState(), args), timeout)); }
public IEnumerable <RantOutput> DoSerial(string input, RNG rng, int charLimit = 0, double timeout = -1, RantProgramArgs args = null) => new Sandbox(this, RantProgram.CompileString(input), rng, charLimit, GetPreservedCarrierState(), args).RunSerial(timeout);
/// <summary> /// Executes the specified pattern and returns a series of outputs. /// </summary> /// <param name="input">The patten to execute.</param> /// <param name="seed">The seed to generate output with.</param> /// <param name="charLimit"> /// The maximum number of characters that can be printed. An exception will be thrown if the limit /// is exceeded. Set to zero or below for unlimited characters. /// </param> /// <param name="timeout">The maximum number of seconds that the pattern will execute for.</param> /// <param name="args">The arguments to pass to the pattern.</param> /// <returns></returns> public IEnumerable <RantOutput> DoSerial(RantProgram input, long seed, int charLimit = 0, double timeout = -1, RantProgramArgs args = null) => new Sandbox(this, input, new RNG(seed), charLimit, GetPreservedCarrierState(), args).RunSerial(timeout);
/// <summary> /// Executes the specified pattern using a custom random number generator and returns the resulting output. /// </summary> /// <param name="input">The pattern to execute.</param> /// <param name="rng">The random number generator to use when generating output.</param> /// <param name="charLimit"> /// The maximum number of characters that can be printed. An exception will be thrown if the limit /// is exceeded. Set to zero or below for unlimited characters. /// </param> /// <param name="timeout">The maximum number of seconds that the pattern will execute for.</param> /// <param name="args">The arguments to pass to the pattern.</param> /// <returns></returns> public RantOutput Do(RantProgram input, RNG rng, int charLimit = 0, double timeout = -1, RantProgramArgs args = null) => RunVM(new Sandbox(this, input, rng, charLimit, GetPreservedCarrierState(), args), timeout);
/// <summary> /// Loads the file located at the specified path and executes it using a custom seed, returning the resulting output. /// </summary> /// <param name="path">The path to the file to execute.</param> /// <param name="rng">The random number generator to use when generating output.</param> /// <param name="charLimit"> /// The maximum number of characters that can be printed. An exception will be thrown if the limit /// is exceeded. Set to zero or below for unlimited characters. /// </param> /// <param name="timeout">The maximum number of seconds that the pattern will execute for.</param> /// <param name="args">The arguments to pass to the pattern.</param> /// <returns></returns> public RantOutput DoFile(string path, RNG rng, int charLimit = 0, double timeout = -1, RantProgramArgs args = null) => RunVM(new Sandbox(this, RantProgram.CompileFile(path), rng, charLimit, GetPreservedCarrierState(), args), timeout);
public RantOutput Do(string input, long seed, int charLimit = 0, double timeout = -1, RantProgramArgs args = null) => RunVM(new Sandbox(this, RantProgram.CompileString(input), new RNG(seed), charLimit, GetPreservedCarrierState(), args), timeout);