package PerlRPG::Math;
use strict;
require Exporter;

use vars qw/@ISA @EXPORT @EXPORT_OK/;
@ISA = qw/Exporter/;
@EXPORT = qw/Constrain MIN MAX/;
@EXPORT_OK = ();

sub MIN {
	return ($_[0] > $_[1] ? $_[0] : $_[1]);
}

sub MAX {
	return ($_[0] > $_[1] ? $_[1] : $_[0]);
}

sub Constrain {
	my($val, $min, $max)=@_;
	return MAX(MIN($val, $min),$max);
}

1;
