Back to project page 4est.
The source code is released under:
MIT License
If you think the Android project 4est 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; //from w w w . j av a 2s.co m import java.util.Random; /** * maps all I2 to random ints */ public class I2IMap implements Pattern.I2I { int[] data; int modu; public I2IMap(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 int get(int x, int y) { int fx = data[x & modu]; return data[(fx + y) & modu]; } }