Skip to content

Commit

Permalink
feat: improved sats variability
Browse files Browse the repository at this point in the history
  • Loading branch information
slntopp committed Feb 9, 2024
1 parent 0e488e8 commit 9744625
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pkg/common/trucks.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func (t *Truck) Start(wg *sync.WaitGroup) {
Sent: time.Now().Format(time.RFC3339),
Status: status.Key,

Sats: rand.Intn(8) + 4,
Sats: sats_chooser.Pick(),
Cell: t.Cell(),
Speed: int(120 * 1 / t.Speed.Seconds()),

Expand Down Expand Up @@ -180,3 +180,11 @@ func (t *Truck) Cell() []string {
strconv.Itoa(rand.Intn(1200) - 600),
}
}

var sats_chooser, _ = wr.NewChooser(
wr.Choice[int]{Item: 0, Weight: 10},
wr.Choice[int]{Item: 2, Weight: 20},
wr.Choice[int]{Item: 3, Weight: 30},
wr.Choice[int]{Item: 4, Weight: 30},
wr.Choice[int]{Item: 8, Weight: 20},
)

0 comments on commit 9744625

Please sign in to comment.