Skip to content

Instantly share code, notes, and snippets.

@deltakosh
Last active September 30, 2020 23:20
Show Gist options
  • Save deltakosh/7fbeb3384ae1bef600de52dc0197e22d to your computer and use it in GitHub Desktop.
Save deltakosh/7fbeb3384ae1bef600de52dc0197e22d to your computer and use it in GitHub Desktop.
class Particle {
private _alpha: number | undefined;
private _beta: number | undefined;
public get alpha(): number {
if (this._alpha === undefined) {
this._alpha = Math.random() > 0.5 ? 2 : 3;
}
return this._alpha;
}
public get beta(): number {
if (this._beta === undefined) {
this._beta = Math.random() > 0.5 ? 2 : 3;
}
return this._beta;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment