# Re: Swapping is inefficient and wasteful

From: Ernst Lippe (ernstl-at-planet-dot-nl_at_ignore.this)
Date: 11/24/04

```Date: Wed, 24 Nov 2004 12:38:54 +0100

```

On Tue, 23 Nov 2004 16:04:57 -0500, Brian Hetrick wrote:

> If one has cryptographically strong random byte source, as from an ARCFOUR
> implementation, a cryptographically strong U[0,1) rand () can be built
> trivially. Assuming arcfour () returns an integer value in [0,255], the
> expression:
>
> ((arcfour () / 256.0f + arcfour ()) / 256.0f + arcfour ()) / 256.0f
>
> gives a float uniformly distributed over [0,1).

That depends on the bitsize of your floats, in this way you
can get only 2**24 different output values, and when your
floats have a mantissa of more than 24 bits there are some
output values that your algorithm can't produce.

Ernst Lippe

## Relevant Pages

• Re: Swapping is inefficient and wasteful
... >> That depends on the bitsize of your floats, in this way you can get only ... I would recommend because it is not very efficient (using ... 24 bits of entropy to select a single card) and because ...
(sci.crypt)
• Re: Swapping is inefficient and wasteful
... > That depends on the bitsize of your floats, ... > floats have a mantissa of more than 24 bits there are some ... lers) where there is no floating point unit. ...
(sci.crypt)
• Re: Swapping is inefficient and wasteful
... > That depends on the bitsize of your floats, ... > floats have a mantissa of more than 24 bits there are some ... the values are "quantized" into bins. ...
(sci.crypt)
• Re: Bringing Back 36-bit Floating-Point Numbers
... have either two doubles or four floats at a time. ... But the reduced precision types are needed too, ... > more advanced algorithm, where they are impractical on the faster ...
(comp.arch)
• Re: As the Crow flies.
... know other competent people will recognize the ... quality in it. ... How did you determine that your algorithm was fast when you hadn't ... Go back to your floats. ...
(talk.origins)