Back to project page splott.
The source code is released under:
MIT License
If you think the Android project splott listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.wordsaretoys.rise.pattern; // ww w . j a v a 2 s. c o m import java.util.Random; /** * maps all I2 to random floats */ public class I2FMap implements Pattern.I2F { static float MI = 1f / (float) Integer.MAX_VALUE; int[] data; int modu; public I2FMap(int length) { data = new int[length]; modu = length - 1; } public void generate() { Random rng = new Random(); for (int i = 0; i < data.length; i++) { data[i] = Math.abs(rng.nextInt()); } } @Override public float get(int x, int y) { int fx = data[x & modu]; int fy = data[(fx + y) & modu]; return (float) fy * MI; } }