I have a PRNG-Class called Generator
. Now, after creating a new instance of it:
var g:Generator = new Generator();
Custom function: set_seed()
- Please review this approach.
I call g.set_seed();
which has the following logic:
public function set_seed(s:Number = 0):void
{
seed = (s > 0) ? s : new Date().getTime();
}
- Pro: I can call it without any arguments, looks more beautiful in the classes I'm using it.
- Con:
set_seed
looks awful and I feel I should be using Flash's Getter/Setter approach.
(I'm getting the seed with: get_seed();
)