using System;
using Gtk;

public partial class MainWindow: Gtk.Window
{	
	public MainWindow (): base (Gtk.WindowType.Toplevel)
	{
		Build ();
		this.Title = "Randomizer";
		this.AllowGrow = true;
		button3.Clicked += new System.EventHandler(this.button3_Click);
	}

	protected void OnDeleteEvent (object sender, DeleteEventArgs a)
	{
		Application.Quit ();
		a.RetVal = true;
	}
	private void button3_Click(object sender, EventArgs e)
	{
		Random r = new Random ();
		double eggs = r.Next (100, 9999);
		int i = r.Next (1, 5);
		while (i != 0) { //Math.Floor because of all teh 1's
			i = i - 1;
			eggs = Math.Sqrt (eggs);
		}
		int multiply = r.Next (1, 10); //Pick a number 1 through 10
		multiply = Convert.ToInt32 (Math.Pow (10, multiply)); //Convert that number to an exponent of 10
		eggs = Math.Floor (eggs * multiply); //eeeeeggggssssss
		string finale = Convert.ToString (eggs);
		int digitSelector = r.Next (0, finale.Length);
		finale = finale.Substring (digitSelector, 1);
		if (finale == "0") {
			label1.Text = "10";
		}
		else {
		label1.Text = finale;
		}
		//go compile yourself
	}
}
