Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commite8beb5604c

README.md

group.by_random

Group a deterministic random subset: each element joins when its own draw falls below fraction. The draw is the portable scoped hash of (seed, channel, element id), so a seed picks the same members every run, machine and platform; channel separates independent draws that share a seed.

Inputs

  • geometry (Geometry). The geometry the group is made on. A copy carrying the group comes out.
  • name (String, default ""). The name the group is written under.
  • class (String, default "point", one of "edge", "point", "primitive", "vertex"). The element class the group lives on.
  • fraction (Float, default 0.5, 0 to 1). The share of elements that join. The draws are independent, so the membership comes out around this share rather than exactly it.
  • seed (Float, default 1). Picks which elements the draw lands on. One seed selects the same members on every run, and changing it reshuffles the whole selection.
  • channel (Float, default 0). Separates independent draws that share a seed: two nodes on one seed and one channel select the same elements.
  • invert (Bool, default false). true takes the complement: the elements the draw did not select.

Outputs

  • geometry (Geometry). The input carrying the group name on class.
local some = g.group.by_random({ geometry = g.points.grid({ countX = 8, countZ = 8 }), name = "picked", fraction = 0.25, seed = 7 })