using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Penguin {
	public class Misc {
		public static float Random(float x0, float x1) {
			Random r = new Random();
			float n = r.Next(0, 99999999);
			return x0 + (x1 - x0) * n / 99999999.0f;
		}

		public static int RandomInt(int x0, int y0) {
			Random r = new Random();
			return r.Next(x0, y0);
		}

		public static float Length(float x1, float x2) {
			return (float)Math.Sqrt(x1 * x1 + x2 * x2);
		}

		public static float Length2(float x1, float x2) {
			return x1 * x1 + x2 * x2;
		}

		public static float Clamp(float x, float x1, float x2) {
			if (x < x1)
				x = x1;
			if (x > x2)
				x = x2;
			return x;
		}

		public static float Lerp(float x0, float x1, float t) {
			return x0 + (x1 - x0) * t;
		}

		public static float Dampen(float _x, float _amount, float _dt) {
			float dampen = _x * _amount * _dt;
			return _x - dampen;
		}
	}
}
