Add duplicate patterns rather than replacing them
This commit is contained in:
parent
17d3e574fb
commit
6ee7f47129
@ -44,6 +44,8 @@ public class RandomPattern extends AbstractPattern {
|
||||
*/
|
||||
public void add(Pattern pattern, double chance) {
|
||||
checkNotNull(pattern);
|
||||
Double existingWeight = weights.get(pattern);
|
||||
if (existingWeight != null) chance += existingWeight;
|
||||
weights.put(pattern, chance);
|
||||
collection = RandomCollection.of(weights, random);
|
||||
this.patterns.add(pattern);
|
||||
|
Loading…
Reference in New Issue
Block a user