JSci.util.RandomMap Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jsci Show documentation
Show all versions of jsci Show documentation
JSci is a set of open source Java packages. The aim is to encapsulate scientific methods/principles in the most natural way possible. As such they should greatly aid the development of scientific based software.
It offers: abstract math interfaces, linear algebra (support for various matrix and vector types), statistics (including probability distributions), wavelets, newtonian mechanics, chart/graph components (AWT and Swing), MathML DOM implementation, ...
Note: some packages, like javax.comm, for the astro and instruments package aren't listed as dependencies (not available).
The newest version!
package JSci.util;
import JSci.maths.*;
/**
* This class defines a random map.
*/
public final class RandomMap implements Mapping, ComplexMapping {
private final double min,max;
/**
* A random map that generates numbers
* between 0.0 and 1.0.
*/
public final static RandomMap MAP=new RandomMap();
/**
* Constructs a random map with the range [0.0,1.0].
*/
public RandomMap() {
this(0.0,1.0);
}
/**
* Constructs a random map with a specified range.
* @param minimum smallest random number to generate
* @param maximum largest random number to generate
*/
public RandomMap(double minimum,double maximum) {
min=minimum;
max=maximum;
}
public double map(double x) {
return ExtraMath.random(min, max);
}
public Complex map(Complex z) {
return new Complex(map(z.real()),map(z.imag()));
}
public Complex map(double real,double imag) {
return new Complex(map(real),map(imag));
}
}