public void Execute() { var count = Points.Length; var ptr = Points.GetPointer(0); var random = new Random(0x6E624EB7u); var radius2 = Radius + Radius; var radius2Vec = new LVector3(radius2, radius2, radius2); var radiusVec = new LVector3(Radius, Radius, Radius); var minPointer = Center - radiusVec; for (int i = 0; i < count; ++i, ++ptr) { *ptr = minPointer + random.NextVector3() * radius2Vec; } }
public void Execute() { var radiusSquared = Radius * Radius; var pointsFound = 0; var count = Points.Length; var ptr = Points.GetPointer(0); var random = new Random(0x6E624EB7u); var Radius2 = Radius + Radius; var radius2Vec = new LVector3(Radius2, Radius2, Radius2); var radiusVec = new LVector3(Radius, Radius, Radius); while (pointsFound < count) { var p = random.NextVector3() * radius2Vec - radiusVec; if (math.lengthsq(p) < radiusSquared) { *ptr = Center + p; pointsFound++; ++ptr; } } }