Class: PwFoo::SrandSeedGenerator
- Inherits:
-
Object
- Object
- PwFoo::SrandSeedGenerator
- Defined in:
- lib/pwfoo/srand_seed_generator.rb
Instance Method Summary collapse
- #_get_checksum ⇒ Object
- #get_next_seed ⇒ Object
-
#initialize ⇒ SrandSeedGenerator
constructor
A new instance of SrandSeedGenerator.
Constructor Details
#initialize ⇒ SrandSeedGenerator
Returns a new instance of SrandSeedGenerator.
5 6 |
# File 'lib/pwfoo/srand_seed_generator.rb', line 5 def initialize end |
Instance Method Details
#_get_checksum ⇒ Object
15 16 17 |
# File 'lib/pwfoo/srand_seed_generator.rb', line 15 def _get_checksum Digest::MD5.hexdigest(`ps axww | gzip`) end |
#get_next_seed ⇒ Object
8 9 10 11 12 13 |
# File 'lib/pwfoo/srand_seed_generator.rb', line 8 def get_next_seed time_in_micro = Time.new().to_f * 100000 checksum = _get_checksum time_in_micro * time_in_micro + checksum.to_i end |