C# Saved Program: quiescent-rain

facebook share

Here's the online compiler accompanied with IDE at your service. This is a saved code by one of our users. Try it out or save your own from the IDE page and don't forget to leave a feedback. You can find that at the bottom of the page.


using System;

public class New3GEvent {
  
  public static void Main (string[] args)
  {
    uint seed = (uint)new Random().Next(0, 0x10000);
    //uint seed = (uint)new Random().Next(Int32.MinValue, Int32.MaxValue);
    
    uint rand1 = Next(seed); // PIDH
    uint rand2 = Next(rand1); // PIDL
    uint rand3 = Next(rand2); // IV1
    uint rand4 = Next(rand3); // IV2
    uint rand5 = Next(rand4); // OTG
    uint rand6 = Next(rand5);
      
    uint[] ivs = ParseStats((rand3 >> 0x10) & 0x7FFF, (rand4 >> 0x10) & 0x7FFF);

    Console.WriteLine("Seed: {0:X4}", seed);
    Console.WriteLine("PID:  {0:X8}", (rand1 >> 0x10) << 0x10 | (rand2 >> 0x10));
    Console.WriteLine("IVs:  {0}, {1}, {2}, {4}, {5}, {3}", ivs[0], ivs[1], ivs[2], ivs[3], ivs[4], ivs[5]);
    Console.WriteLine("OTG:  {0}", ((rand5 >> 0x17) & 1) == 0 ? "Female" : "Male");
    
    Console.WriteLine("-----");
    
    ivs = ParseStats((rand4 >> 0x10) & 0x7FFF, (rand5 >> 0x10) & 0x7FFF);
    
    Console.WriteLine("Seed: {0:X4}", seed);
    Console.WriteLine("PID:  {0:X8}", (rand2 >> 0x10) << 0x10 | (rand1 >> 0x10));
    Console.WriteLine("IVs:  {0}, {1}, {2}, {4}, {5}, {3}", ivs[0], ivs[1], ivs[2], ivs[3], ivs[4], ivs[5]);
  }
  
  public static uint Next(uint seed)
  {
    return seed * 0x41C64E6Du + 0x00006073u;
  }
  
	public static uint[] ParseStats( uint first, uint second )
	{
		uint[] stats = new uint[6];

		stats[0] = first & 0x1F; //HP
		stats[1] = ( first & 0x3E0 ) >> 0x5; //Attack
		stats[2] = ( first & 0x7C00 ) >> 0xA; //Defense

		stats[3] = second & 0x1F; //Speed
		stats[4] = ( second & 0x3E0 ) >> 0x5; //Sp. Attack
		stats[5] = ( second & 0x7C00 ) >> 0xA; //Sp. Defense

		return stats;
	}
}
Execute

Output

Press the execute button or CTRL + enter to run code.

Inputs