Changed default seed to (current-milliseconds)

This commit is contained in:
Ariela Wenner 2020-01-09 15:54:19 -03:00
parent bd73ed6c6e
commit 5ed9cb25ef
3 changed files with 6 additions and 9 deletions

View File

@ -13,7 +13,7 @@ Additionally, the `-b <token>` option specifies a prefix to append to the beggin
By default, each iteration changes only one character of the key. The `-w` option tells `eliana` to change the whole key every iteration. Taking CHICKEN's pseudo random number generator algorithm into consideration, though, this option might be completely unnecessary. See [this](https://en.wikipedia.org/wiki/Well_equidistributed_long-period_linear) for more information.
Finally, `-s <seed>` will let you specify a seed for the PRNG. Otherwise, the current [Epoch time](https://https://en.wikipedia.org/wiki/Unix_time) is used.
Finally, `-s <seed>` will let you specify a seed for the PRNG. Otherwise, the current millisecond since machine startup is used.
By itself, `eliana` is not very useful. You need to pipe its output to a program that can read, say, a dictionary, from standard input.

View File

@ -7,7 +7,6 @@
(import scheme
(chicken base)
(chicken random)
(chicken time)
(chicken keyword)
r7rs)
@ -54,8 +53,5 @@
(define (make-key-container key-length)
(make-string key-length #\0))
(define (eliana-initialize! #!optional seed)
(set-pseudo-random-seed!
(if seed
seed
(number->string (current-seconds))))))
(define (eliana-initialize! seed)
(set-pseudo-random-seed! seed)))

View File

@ -1,5 +1,6 @@
(import (prefix eliana-module eli:)
(prefix eliana-argparse argp:))
(prefix eliana-argparse argp:)
(chicken time))
(define DEFAULT-DATA-SET
"abcdefghijkmnopqrstuvwxyzABCDEFGHIJKMNOPQRSTUVWXYZ1234567890")
@ -56,7 +57,7 @@
(key-container (eli:make-key-container key-length))
(prefix (get-argument-value-or-default "-b" #f))
(postfix (get-argument-value-or-default "-a" #f))
(seed (get-argument-value-or-default "-s" #f)))
(seed (get-argument-value-or-default "-s" (number->string (current-milliseconds)))))
(eli:eliana-initialize! seed)
(let loop ()
(eli:change-key! key-container data-set change-entire-key?)