EntityQuery.Random Method
Definition¶
Namespace: Brine2D.ECS.Query
| Overloads | |
|---|---|
| Random() | Executes the query and returns a single random matching entity, or null. |
| Random(int) | Executes the query and returns N random matching entities. |
EntityQuery.Random() Method¶
Executes the query and returns a single random matching entity, or null.
public Brine2D.ECS.Entity? Random();
Returns¶
Remarks¶
Uses reservoir sampling to avoid materializing the full result set.
EntityQuery.Random(int) Method¶
Executes the query and returns N random matching entities.
public System.Collections.Generic.List<Brine2D.ECS.Entity> Random(int count);
Parameters¶
count System.Int32
Returns¶
System.Collections.Generic.List<Entity>
Remarks¶
Uses reservoir sampling (Algorithm R) to select a uniformly random subset without materializing the full result set.