private static void test09() //****************************************************************************80 // // Purpose: // // TEST09 tests CONG_SEEDED. // // Licensing: // // This code is distributed under the GNU LGPL license. // // Modified: // // 18 October 2013 // // Author: // // John Burkardt // { int j; Console.WriteLine(""); Console.WriteLine("TEST09"); Console.WriteLine(" CONG_SEEDED is a generator of pseudorandom uniformly"); Console.WriteLine(" distributed unsigned 32 bit integers."); Console.WriteLine(""); Console.WriteLine(" Input Seed Output Seed Output Value"); Console.WriteLine(""); int jcong_new = 234567891; for (j = 1; j <= 10; j++) { int jcong_old = jcong_new; int jcong_in = jcong_new; jcong_new = Congruential.cong_seeded(ref jcong_in); Console.WriteLine(" " + jcong_old.ToString().PadLeft(12) + " " + jcong_in.ToString().PadLeft(12) + " " + jcong_new.ToString().PadLeft(12) + ""); } }
public static int kiss_seeded(ref int jcong, ref int jsr, ref int w, ref int z) //****************************************************************************80 // // Purpose: // // KISS_SEEDED evaluates the KISS random number generator. // // Licensing: // // This code is distributed under the GNU LGPL license. // // Modified: // // 18 October 2013 // // Author: // // John Burkardt // // Reference: // // George Marsaglia, Wai Wan Tsang, // The Ziggurat Method for Generating Random Variables, // Journal of Statistical Software, // Volume 5, Number 8, October 2000, seven pages. // // Parameters: // // Input/output, uint32_t &JCONG, uint32_t &JSR, uint32_t &W, uint32_t &Z, // the seeds, which are updated on each call. // // Output, uint32_t KISS_SEEDED, the new value. // { int value = (MultiplyWithCarry.mwc_seeded(ref w, ref z) ^ Congruential.cong_seeded(ref jcong)) + SHR3.shr3_seeded(ref jsr); return(value); }