We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 57f0611 commit fe21841Copy full SHA for fe21841
app/controllers/master-controller.js
@@ -26,6 +26,18 @@
26
}
27
28
29
+ // I get a random coordinate based on the given constraints.
30
+ function getRandomCoordinate( minCoordinate, maxCoordinate ) {
31
+
32
+ var delta = ( maxCoordinate - minCoordinate );
33
34
+ return(
35
+ minCoordinate + Math.floor( Math.random() * delta )
36
+ );
37
38
+ }
39
40
41
// -- Define Scope Methods. --------------------- //
42
43
@@ -57,12 +69,12 @@
57
69
58
70
59
71
// This is our list of slaves and their coordinates. Starting with an initial
60
- // collection of one.
72
+ // collection of one (at a random position).
61
73
$scope.slaves = [
62
74
{
63
75
id: 1,
64
- x: 100,
65
- y: 100
76
+ x: getRandomCoordinate( 50, 400 ),
77
+ y: getRandomCoordinate( 50, 200 )
66
78
67
79
];
68
80
0 commit comments