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 int
size
-
Constructor Summary
Constructors Constructor Description BalancedPermutations()
BalancedPermutations(int size, long stateA, long stateB)
-
Method Summary
Modifier and Type Method Description void
fill(int[] items)
Fillsitems
with a balanced permutation from 0 tosize - 1
.GreasedRegion
rotatedGrid()
GreasedRegion
shuffledGrid()
GreasedRegion
shuffledGridMultiple(int repeats)
-
Field Details
-
Constructor Details
-
Method Details
-
fill
Fillsitems
with a balanced permutation from 0 tosize - 1
. The length ofitems
must 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
-