Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #26483

Re: random password generator

From Paul Rubin <no.email@nospam.invalid>
Newsgroups comp.lang.forth
Subject Re: random password generator
Date 2013-10-13 14:43 -0700
Organization Nightsong/Fort GNOX
Message-ID <7xppr8u9r7.fsf@ruckus.brouhaha.com> (permalink)
References <7x38o5zzwz.fsf@ruckus.brouhaha.com> <l3ep0h$43g$1@online.de> <7xbo2tc6pn.fsf@ruckus.brouhaha.com> <l3f15p$ev2$1@online.de>

Show all headers | View raw


Bernd Paysan <bernd.paysan@gmx.de> writes:
>>>rot * 16 rshift + c@ ;

> No, I mean multiply and then divide (with a right shift in this
> case). u16 is 0..ffff, and by dividing it is between [0..1[.  That
> gives a uniform distribution over all characters in the string, and is
> typically faster than a modulus.

Aha, very clever, it was confusing at first because small examples end
up at 0.  Basically the lower bits of the u16 are mostly thrown away,
while modulus uses the lower bits and mostly throws away the upper ones.
It works out about the same in the end.  Both methods are slightly
non-uniform unless the alphabet size exactly divides 2**16, but that's
fine for this purpose (the effect on the output distribution's entropy
is almost zero).  Thanks again.

Back to comp.lang.forth | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

random password generator Paul Rubin <no.email@nospam.invalid> - 2013-10-12 19:07 -0700
  Re: random password generator hughaguilar96@yahoo.com - 2013-10-12 22:01 -0700
  Re: random password generator Paul Rubin <no.email@nospam.invalid> - 2013-10-12 22:32 -0700
    Re: random password generator hughaguilar96@yahoo.com - 2013-10-12 22:44 -0700
  Re: random password generator "WJ" <w_a_x_man@yahoo.com> - 2013-10-13 08:23 +0000
    Re: random password generator Paul Rubin <no.email@nospam.invalid> - 2013-10-13 05:46 -0700
    Re: random password generator "WJ" <w_a_x_man@yahoo.com> - 2013-10-13 17:09 +0000
  Re: random password generator Bernd Paysan <bernd.paysan@gmx.de> - 2013-10-13 20:32 +0200
    Re: random password generator Paul Rubin <no.email@nospam.invalid> - 2013-10-13 12:27 -0700
      Re: random password generator Bernd Paysan <bernd.paysan@gmx.de> - 2013-10-13 22:52 +0200
        Re: random password generator Paul Rubin <no.email@nospam.invalid> - 2013-10-13 14:43 -0700

csiph-web