```Path: news.mathworks.com!newsfeed-00.mathworks.com!news.kjsl.com!usenet.stanford.edu!news.ucr.edu!nntp-server.caltech.edu!not-for-mail
From: glen herrmannsfeldt <gah@ugcs.caltech.edu>
Newsgroups: comp.soft-sys.matlab,comp.dsp
Subject: Re: How do I compress an array of floating numbers in Matlab?
Date: Mon, 5 Apr 2010 04:39:43 +0000 (UTC)
Organization: California Institute of Technology, Pasadena
Lines: 34
Message-ID: <hpbpif\$1i\$5@naig.caltech.edu>
NNTP-Posting-Host: thalia.ugcs.caltech.edu
X-Trace: naig.caltech.edu 1270442383 50 131.215.176.116 (5 Apr 2010 04:39:43 GMT)
X-Complaints-To: abuse@caltech.edu
NNTP-Posting-Date: Mon, 5 Apr 2010 04:39:43 +0000 (UTC)
User-Agent: tin/1.9.3-20080506 ("Dalintober") (UNIX) (Linux/2.6.26-2-686 (i686))
Xref: news.mathworks.com comp.soft-sys.matlab:623486 comp.dsp:270006

In comp.dsp robert bristow-johnson <rbj@audioimagination.com> wrote:
> On Apr 4, 1:58?pm, glen herrmannsfeldt <g...@ugcs.caltech.edu> wrote:

>> Continuing, the output of a linear-congruential random number
>> generator is also easy to predict if you know the constants of
>> the generator.

> yeah, i guess you need a couple of constants and the initial seed
> value.  but don't you also need to somehow encode the rng algorithm,
> too?

Well, linear congruential pretty much means multiply by
a constant, add a constant (possibly zero) and modulo a constant.
I am not actually sure how long it takes, given a sufficiently
long sample of the output, to find the constants.

>> ?If you don't, and you have a big enough sample,
>> then you can likely find the pattern. ?(If you have the bits
>> exactly, though I am not sure how long it would take.)

>> If you have, say, sin() of the linear-congruential number
>> stream then it is likely much more difficult. ?

> it will look different in a histogram.  suppose the rng was scaled to
> be uniformly distributed over a segment as long as any multiple of
> 2pi, then the p.d.f. would go up as it approaches +1 or -1.

Yes you could do that.  But assuming that you have the ability
to find the constants for an LCG from the output, it is much
harder if you don't have all the bits of the generator output.
If, for example, you have the single precision sine then you
likely don't have enough bits after taking the arcsine.

-- glen
```