Package squidpony.squidmath
Class BalancedPermutations
java.lang.Object
squidpony.squidmath.BalancedPermutations
public class BalancedPermutations extends Object
Based on Martin Roberts' blog post about
blue noise point sets, this class generates "balanced" permutations of a specific size with good performance.
-
Field Summary
Fields Modifier and Type Field Description intsize -
Constructor Summary
Constructors Constructor Description BalancedPermutations()BalancedPermutations(int size, long stateA, long stateB) -
Method Summary
Modifier and Type Method Description voidfill(int[] items)Fillsitemswith a balanced permutation from 0 tosize - 1.GreasedRegionrotatedGrid()GreasedRegionshuffledGrid()GreasedRegionshuffledGridMultiple(int repeats)
-
Field Details
-
Constructor Details
-
Method Details
-
fill
Fillsitemswith a balanced permutation from 0 tosize - 1. The length ofitemsmust be at leastsize. This may take a while if size is large; half a second is reasonable for when size is 48, with smaller sizes taking much less time and larger ones taking much more.- Parameters:
items- an int array which will be modified in-place
-
rotatedGrid
-
shuffledGrid
-
shuffledGridMultiple
-