001 /* 002 * Created on Feb 16, 2005 003 * 004 */ 005 package aima.test.probabilitytest; 006 007 import aima.probability.Randomizer; 008 009 /** 010 * @author Ravi Mohan 011 * 012 */ 013 014 public class MockRandomizer implements Randomizer { 015 016 private double[] values; 017 018 private int index; 019 020 public MockRandomizer(double[] values) { 021 this.values = values; 022 this.index = 0; 023 } 024 025 public double nextDouble() { 026 if (index == values.length) { 027 index = 0; 028 } 029 030 double value = values[index]; 031 index++; 032 return value; 033 } 034 035 }