Created
October 26, 2020 19:52
-
-
Save ivank2139/90190c4088509562c8d4ee48aa336434 to your computer and use it in GitHub Desktop.
Generates 26 named nodes using random x y coordinates
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func GenNodes() string { | |
var sbldr = strings.Builder{} | |
for _, node := range NodeNames { | |
x := decimal.NewFromInt(int64(rand.Intn(GridMax-GridMin) + GridMin)) | |
y := decimal.NewFromInt(int64(rand.Intn(GridMax-GridMin) + GridMin)) | |
if !colocation(x, y) { | |
Nodes[node] = *NewNode(node, x, y) | |
} else { | |
log.Error.Println("Found colocated instance") | |
} | |
} | |
sbldr.WriteString("\n\nGenerated " + strconv.Itoa(len(Nodes)) + " named nodes with random x y data points between " + | |
strconv.Itoa(GridMin) + " and " + strconv.Itoa(GridMax)) | |
return sbldr.String() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment