Rename Simulation function adding random patterns

Rename from addPattern to addRandomPattern to more clearly signify its purpose.
This commit is contained in:
Unknown 2018-10-18 11:32:00 +02:00
parent f1399064a2
commit 4f92c69a82
2 changed files with 3 additions and 3 deletions

View file

@ -55,7 +55,7 @@ class Engine {
_simulation = Simulation(x, y); _simulation = Simulation(x, y);
_elapsed.start(); _elapsed.start();
_simulation.addPattern(amount: 15, dispersal: 5); _simulation.addRandomPattern(amount: 15, dispersal: 5);
html.window.animationFrame.then(animFrame); html.window.animationFrame.then(animFrame);
} }
@ -129,7 +129,7 @@ class Engine {
} }
void addPattern({int amount, int dispersal}) { void addPattern({int amount, int dispersal}) {
_simulation.addPattern(amount: amount, dispersal: dispersal); _simulation.addRandomPattern(amount: amount, dispersal: dispersal);
} }
void toggleEdgeRendering() { void toggleEdgeRendering() {

View file

@ -30,7 +30,7 @@ class Simulation {
_dirty = true; _dirty = true;
} }
void addPattern({int amount, int dispersal}) { void addRandomPattern({int amount, int dispersal}) {
int _startingSeed = DateTime.now().millisecondsSinceEpoch; int _startingSeed = DateTime.now().millisecondsSinceEpoch;
math.Random rng = new math.Random(_startingSeed); math.Random rng = new math.Random(_startingSeed);
_amount = amount ?? rng.nextInt(20); _amount = amount ?? rng.nextInt(20);