Separating scheduler into bunch of files
diff --git a/scheduler/random-interval-generator.h b/scheduler/random-interval-generator.h
new file mode 100644
index 0000000..c0f6276
--- /dev/null
+++ b/scheduler/random-interval-generator.h
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2013 University of California, Los Angeles
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
+ * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#ifndef RANDOM_INTERVAL_GENERATOR_H
+#define RANDOM_INTERVAL_GENERATOR_H
+
+#include "interval-generator.h"
+
+#include <boost/random/mersenne_twister.hpp>
+#include <boost/random/uniform_real.hpp>
+#include <boost/random/variate_generator.hpp>
+
+// generates intervals with uniform distribution
+class RandomIntervalGenerator : public IntervalGenerator
+{
+public:
+ typedef enum
+ {
+ UP = 1,
+ DOWN = 2,
+ EVEN = 3
+ } Direction;
+
+public:
+ // percent is random-range/interval; e.g. if interval is 10 and you wish the random-range to be 2
+ // e.g. 9 ~ 11, percent = 0.2
+ // direction shifts the random range; e.g. in the above example, UP would produce a range of
+ // 10 ~ 12, DOWN of 8 ~ 10, and EVEN of 9 ~ 11
+ RandomIntervalGenerator(double interval, double percent, Direction direction = EVEN);
+ ~RandomIntervalGenerator(){}
+
+ virtual double
+ nextInterval() _OVERRIDE;
+
+private:
+ inline double fractional(double x) { double dummy; return abs(modf(x, &dummy)); }
+
+private:
+ typedef boost::mt19937 RNG_TYPE;
+ RNG_TYPE m_rng;
+ boost::uniform_real<> m_dist;
+ boost::variate_generator<RNG_TYPE &, boost::uniform_real<> > m_random;
+ Direction m_direction;
+ double m_percent;
+ double m_interval;
+
+};
+#endif // RANDOM_INTERVAL_GENERATOR_H