Re: OT: RFC, PRNG
- From: "cr88192" <cr88192@xxxxxxxxxxxxxxxxxx>
- Date: Mon, 28 May 2007 06:41:36 +1000
"Josiah Carlson" <josiah.carlson@xxxxxxxxxxxxx> wrote in message
news:BCk6i.9541$2v1.2979@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
cr88192 wrote:
well, I lack much better place to ask about this.
for a project of mine, I have needed a fairly special PRNG. the point is
to have a sufficiently large amount of entropy that it generates
hopefully-unique strings.
additionally, it is important that the generated strings are different
each time the app is run, and are different between different
installations.
in general, I am using a 4096-bit state.
the state is preserved in files.
Don't guess, just use Mersenne Twister. Note that neither Mersenne
Twister, nor your algorithm, are technically guaranteed to not produce
duplicate strings of 96 bits. Then there's the other perspective that
will tell you, "just use /dev/urandom on *nix".
2 problems:
I don't like using other peoples' code if avoidable (I am fussy about this);
I don't have access to '/dev/urandom', because in part, I am currently
running on windows.
I am mostly just hoping that the probability of clashes is sufficiently low
that they are unlikely in practice (anything much beyond 1.0/2^32 would
probably be fine).
me just hoping this has sufficient entropy.
that is part of why I use a load, mutate, and save approach.
the hope is that with repeated runs the entropy will increase making it more
random.
another previous approach for comming up with random numbers (typically used
as seeds), was to do a bunch of tweaky behavior involving timing (ie: with
clock). the issue though is that this approach takes up some small amount of
time (but is at least fairly good about being random IME).
but, yeah, usually for things like this (small and simple) I write a
specialized version for each case where the need arises (and sometimes
different uses combine to form interesting occurances).
what I had hoped for was more commentary on the algo specifics, ie, any
obvious flaws, ...
In terms of your requirements (which sounds like a method for producing
variable names), generate a sequence of characters and sanitize it as you
go.
yeah, basically.
they are for compiler-generated names, aka a gensym mechanism.
in the past, I had used a special prefix and sequential numbers, but this
wont work if the files are stored externally.
sadly, schemes with a higher base, don't really save many chars.
base64 would save 2-chars over base48, but base32 would be 3-chars longer.
shorter names are better, but so is avoiding clashes, so it is a tradeoff...
- Josiah
.
- Follow-Ups:
- Re: OT: RFC, PRNG
- From: Josiah Carlson
- Re: OT: RFC, PRNG
- From: Ben Rudiak-Gould
- Re: OT: RFC, PRNG
- References:
- OT: RFC, PRNG
- From: cr88192
- Re: OT: RFC, PRNG
- From: Josiah Carlson
- OT: RFC, PRNG
- Prev by Date: Re: OT: RFC, PRNG
- Next by Date: Re: Any zip or tgz that decompress to itself ?
- Previous by thread: Re: OT: RFC, PRNG
- Next by thread: Re: OT: RFC, PRNG
- Index(es):
Relevant Pages
|