MCPcopy
hub / github.com/fogleman/primitive / NewRandomRectangle

Function NewRandomRectangle

primitive/rectangle.go:16–23  ·  view source on GitHub ↗
(worker *Worker)

Source from the content-addressed store, hash-verified

14}
15
16func NewRandomRectangle(worker *Worker) *Rectangle {
17 rnd := worker.Rnd
18 x1 := rnd.Intn(worker.W)
19 y1 := rnd.Intn(worker.H)
20 x2 := clampInt(x1+rnd.Intn(32)+1, 0, worker.W-1)
21 y2 := clampInt(y1+rnd.Intn(32)+1, 0, worker.H-1)
22 return &Rectangle{worker, x1, y1, x2, y2}
23}
24
25func (r *Rectangle) bounds() (x1, y1, x2, y2 int) {
26 x1, y1 = r.X1, r.Y1

Callers 1

RandomStateMethod · 0.85

Calls 1

clampIntFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…