# Re: Constructing a random permutation on the fly

*From*: Paul Rubin <http://phr.cx@xxxxxxxxxxxxxx>*Date*: 10 Jun 2009 08:47:48 -0700

Ilmari Karonen <usenet2@xxxxxxxxxxxxxx> writes:

Seriously, this was the answer I was going to post. To expand a

little on it, the "Hasty Pudding trick" is to start with a number in

the desired range and iterate the encryption function until you get a

result that is also in the range. The fact that a block cipher is a

permutation guarantees that this procedure will terminate,

The process is actually not guaranteed to terminate, since the

permutation can have cycles. For n=100000 the probability of this may

be enough that you have to adjust the scheme to allow for it.

.

**Follow-Ups**:**Re: Constructing a random permutation on the fly***From:*Scott Fluhrer

**Re: Constructing a random permutation on the fly***From:*Thomas ***in

**References**:**Constructing a random permutation on the fly***From:*Tom Anderson

**Re: Constructing a random permutation on the fly***From:*Paul Rubin

**Re: Constructing a random permutation on the fly***From:*Ilmari Karonen

- Prev by Date:
**Re: Constructing a random permutation on the fly** - Next by Date:
**Re: Constructing a random permutation on the fly** - Previous by thread:
**Re: Constructing a random permutation on the fly** - Next by thread:
**Re: Constructing a random permutation on the fly** - Index(es):