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


Groups > comp.lang.forth > #26916 > unrolled thread

LC53, a respectable random generator?

Started byalbert@spenarnc.xs4all.nl (Albert van der Horst)
First post2013-11-23 16:25 +0000
Last post2013-11-28 18:14 -0800
Articles 20 on this page of 62 — 13 participants

Back to article view | Back to comp.lang.forth


Contents

  LC53, a respectable random generator? albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-11-23 16:25 +0000
    Re: LC53, a respectable random generator? hughaguilar96@yahoo.com - 2013-11-23 17:34 -0800
      Re: LC53, a respectable random generator? hughaguilar96@yahoo.com - 2013-11-23 19:03 -0800
      Re: LC53, a respectable random generator? albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-11-24 04:58 +0000
    Re: LC53, a respectable random generator? "Rod Pemberton" <dont_use_email@xnohavenotit.cnm> - 2013-11-24 04:57 -0500
      Re: LC53, a respectable random generator? albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-11-24 14:17 +0000
        Re: LC53, a respectable random generator? mhx@iae.nl - 2013-11-24 08:12 -0800
          Re: LC53, a respectable random generator? albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-11-24 16:46 +0000
          Re: LC53, a respectable random generator? Bernd Paysan <bernd.paysan@gmx.de> - 2013-11-24 23:53 +0100
            Re: LC53, a respectable random generator? mhx@iae.nl - 2013-11-24 15:41 -0800
              Re: LC53, a respectable random generator? hughaguilar96@yahoo.com - 2013-11-24 17:57 -0800
              Re: LC53, a respectable random generator? albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-11-25 19:32 +0000
                Re: LC53, a respectable random generator? mhx@iae.nl - 2013-11-25 14:22 -0800
                Re: LC53, a respectable random generator? Bernd Paysan <bernd.paysan@gmx.de> - 2013-11-26 00:20 +0100
                  Re: LC53, a respectable random generator? albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-11-26 03:29 +0000
                    Re: LC53, a respectable random generator? thomas.bartscher@gmail.com - 2013-11-25 23:08 -0800
                      Re: LC53, a respectable random generator? hughaguilar96@yahoo.com - 2013-11-26 05:06 -0800
                        Re: LC53, a respectable random generator? albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-11-26 14:03 +0000
                        Re: LC53, a respectable random generator? Bernd Paysan <bernd.paysan@gmx.de> - 2013-11-26 21:59 +0100
                        Re: LC53, a respectable random generator? thomas.bartscher@gmail.com - 2013-11-28 01:32 -0800
                  Re: LC53, a respectable random generator? hughaguilar96@yahoo.com - 2013-11-25 19:43 -0800
                Re: LC53, a respectable random generator? hughaguilar96@yahoo.com - 2013-11-25 19:31 -0800
                Re: LC53, a respectable random generator? "Elizabeth D. Rather" <erather@forth.com> - 2013-11-25 19:24 -1000
                  Re: LC53, a respectable random generator? hughaguilar96@yahoo.com - 2013-11-26 05:17 -0800
                  Re: LC53, a respectable random generator? albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-11-26 14:21 +0000
                  Re: LC53, a respectable random generator? hughaguilar96@yahoo.com - 2013-11-28 18:49 -0800
              Re: LC53, a respectable random generator? mhx@iae.nl - 2013-11-25 13:52 -0800
            Re: LC53, a respectable random generator? hughaguilar96@yahoo.com - 2013-11-24 18:03 -0800
            Re: LC53, a respectable random generator? Matthias Koch <matthias.koch@hot.uni-hannover.de> - 2013-11-25 13:41 +0100
              Re: LC53, a respectable random generator? mhx@iae.nl - 2013-11-25 10:23 -0800
                Re: LC53, a respectable random generator? Howerd <howerdo@yahoo.co.uk> - 2013-11-25 13:43 -0800
                  Re: LC53, a respectable random generator? mhx@iae.nl - 2013-11-25 15:16 -0800
                    Re: LC53, a respectable random generator? Howerd <howerdo@yahoo.co.uk> - 2013-11-26 13:38 -0800
                      Re: LC53, a respectable random generator? hughaguilar96@yahoo.com - 2013-11-26 20:42 -0800
                        Re: LC53, a respectable random generator? albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-11-27 11:46 +0000
                          Re: LC53, a respectable random generator? hughaguilar96@yahoo.com - 2013-11-27 18:35 -0800
                      Re: LC53, a respectable random generator? hughaguilar96@yahoo.com - 2013-11-26 21:41 -0800
                        Re: LC53, a respectable random generator? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-11-27 03:21 -0600
                          Re: LC53, a respectable random generator? albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-11-27 15:37 +0000
                            Re: LC53, a respectable random generator? Bernd Paysan <bernd.paysan@gmx.de> - 2013-11-27 23:01 +0100
                              Re: LC53, a respectable random generator? albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-11-27 23:39 +0000
                              Re: LC53, a respectable random generator? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-11-28 05:41 -0600
                                Re: LC53, a respectable random generator? albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-11-28 13:47 +0000
                                  Re: LC53, a respectable random generator? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-11-28 09:10 -0600
                                Re: LC53, a respectable random generator? Bernd Paysan <bernd.paysan@gmx.de> - 2013-11-28 16:22 +0100
                                  Re: LC53, a respectable random generator? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-11-28 09:34 -0600
                                  Re: LC53, a respectable random generator? hughaguilar96@yahoo.com - 2013-11-28 18:39 -0800
                        Re: LC53, a respectable random generator? albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-11-27 16:44 +0000
              Re: LC53, a respectable random generator? Bernd Paysan <bernd.paysan@gmx.de> - 2013-11-25 19:51 +0100
        Re: LC53, a respectable random generator? hughaguilar96@yahoo.com - 2013-11-24 11:13 -0800
          Re: LC53, a respectable random generator? Hans Bezemer <the.beez.speaks@gmail.com> - 2013-11-25 09:52 +0100
    Re: LC53, a respectable random generator? hughaguilar96@yahoo.com - 2013-11-24 13:07 -0800
      Re: LC53, a respectable random generator? albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-11-25 02:18 +0000
        Re: LC53, a respectable random generator? hughaguilar96@yahoo.com - 2013-11-24 19:36 -0800
    Re: LC53, a respectable random generator? "Ed" <invalid@invalid.com> - 2013-11-26 12:57 +1100
      Re: LC53, a respectable random generator? hughaguilar96@yahoo.com - 2013-11-26 21:25 -0800
      Re: LC53, a respectable random generator? albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-11-27 15:48 +0000
    Re: LC53, a respectable random generator? Mark Wills <markrobertwills@yahoo.co.uk> - 2013-11-27 01:10 -0800
      Re: LC53, a respectable random generator? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-11-27 03:29 -0600
        Re: LC53, a respectable random generator? hughaguilar96@yahoo.com - 2013-11-27 19:49 -0800
          Re: LC53, a respectable random generator? Bernd Paysan <bernd.paysan@gmx.de> - 2013-11-28 15:57 +0100
            Re: LC53, a respectable random generator? hughaguilar96@yahoo.com - 2013-11-28 18:14 -0800

Page 3 of 4 — ← Prev page 1 2 [3] 4  Next page →


#27016

Fromalbert@spenarnc.xs4all.nl (Albert van der Horst)
Date2013-11-27 23:39 +0000
Message-ID<52968295$0$26895$e4fe514c@dreader37.news.xs4all.nl>
In reply to#27012
In article <l75q3m$fq9$1@online.de>, Bernd Paysan  <bernd.paysan@gmx.de> wrote:
>Albert van der Horst wrote:
>
>> (I cancelled a post where I said that an LC53 type always has
>> a period of p-1. What was I thinking?)
>
>Don't know, but actually it is pretty simple to check candidates for
>primitive roots of LC53.  Faktor p-1:
>
>22605091*19*5*2 = 2^32-5
>
>So for all four prime factors q, you have to test if your candidate g is
>
>g^{(p-1)/q} mod p !== 1.
>
>This can be done quickly.  You don't have to search that long to find a
>primitive root.
>
>Note that Hugh's g is 2^32-333333333, don't confuse things, the sign matters
>(writing it as a negative number as Hugh does is confusing, though).  It
>*is* a primitive root of 2^32-5.  If you want to find primitive roots for
>LC53-style generators quickly, here's some code (factoring done by an
>external program, you migth want to add a sieve up to 2^16 to do the
>factoring right in the program itself):

Apologies to Hugh for the mistake about the multiplier.
I stand corrected. I'm still interested how he found this
without the benefit of some theory.

Bottom line:

********************************************************************
**  The LC53 lng is respectable                                   **
********************************************************************

(as far as lcg's go.)

>--
>Bernd Paysan

Groetjes Albert
-- 
Albert van der Horst, UTRECHT,THE NETHERLANDS
Economic growth -- being exponential -- ultimately falters.
albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst

[toc] | [prev] | [next] | [standalone]


#27031

FromAndrew Haley <andrew29@littlepinkcloud.invalid>
Date2013-11-28 05:41 -0600
Message-ID<eqKdnSUOWM1xtgrPnZ2dnUVZ_oednZ2d@supernews.com>
In reply to#27012
Bernd Paysan <bernd.paysan@gmx.de> wrote:
> 
> LC53 is a maximum period linear congruent random number generator -
> so far, so good.  It has the usual problems of LCGs, so it doesn't
> pass any serious randomness test suite.  It is certainly not worse
> than others,

Did you really mean to say that?  All we know is that it is not
certainly worse.  I doubt very much that a generator chosen without
any theoretical justification or testing is as good as any.  It's not
impossible, but it would be a fantastic stroke of luck.

Despite all of the theoretical work that has been done, I think it's
still true that the best way to find a "good" LC generator is to
search for one using an automated test procedure.

> but it definitely is slower than the mod 2^cellbits ones.  It is
> just a bit faster as the hash-based PRNG I use in Gforth-git now
> (benchmarked on 64 bit machines), which does return 64 bit numbers
> on a 64 bit machine, and so far passed all randomness tests I ran
> from the TestU01 suite (I didn't run the very time consuming
> DieHarder test).

Sure, any LCRNG that uses division isn't going to be fast.  A 64-bit
computer can turn that modulo operation into a couple of
multiplications, a shift, and a subtraction, but it's still not going
to be fast.  2^31 - 1 is prime, so that's a much better choice for a
modulus.

Andrew.

[toc] | [prev] | [next] | [standalone]


#27038

Fromalbert@spenarnc.xs4all.nl (Albert van der Horst)
Date2013-11-28 13:47 +0000
Message-ID<5297496f$0$1686$e4fe514c@dreader35.news.xs4all.nl>
In reply to#27031
In article <eqKdnSUOWM1xtgrPnZ2dnUVZ_oednZ2d@supernews.com>,
Andrew Haley  <andrew29@littlepinkcloud.invalid> wrote:
>Bernd Paysan <bernd.paysan@gmx.de> wrote:
>>
>> LC53 is a maximum period linear congruent random number generator -
>> so far, so good.  It has the usual problems of LCGs, so it doesn't
>> pass any serious randomness test suite.  It is certainly not worse
>> than others,
>
>Did you really mean to say that?  All we know is that it is not
>certainly worse.  I doubt very much that a generator chosen without
>any theoretical justification or testing is as good as any.  It's not
>impossible, but it would be a fantastic stroke of luck.

Sure Hugh got lucky, but it is not as fantastic as you might think.
The choice of a prime just under 2^32 is a bit of sound reasoning,
as soon as you're willing to pay the price for a mod operation.
It is known that in the row 'a' 'a^2' mod p etc. 'a' cannot be recovered
easily from 'a^2'. Square root of 'a' modulo a prime is as hard as
factoring, so if you choose a random looking 'a' larger than the root,
the second number is pretty unrelated.
Then test for a large period. This can be done without even the
knowledge that there are multipliers with a large period, or realizing
what the period is. Brute force will do it.

>
>Despite all of the theoretical work that has been done, I think it's
>still true that the best way to find a "good" LC generator is to
>search for one using an automated test procedure.

Especially in view of the following. You're using the generator for
something. Now some tests will be especially relevant to what you do,
others are not. If you plan to select Tetris blocks, the
correlation test probably matters, and you want an even distribution.
Pass would do, flying colours is not necessary. (I've a cross, so
I've a 0.1% larger chance of getting an L next.)
You can ignore other tests. E.g. the birthday test, requires that
with 32 bits random numbers you get two same numbers once in a
run of about 65,000. No lcg can pass that test, because same numbers are
2^32 apart. Not relevant for Tetris though.

>
>> but it definitely is slower than the mod 2^cellbits ones.  It is
>> just a bit faster as the hash-based PRNG I use in Gforth-git now
>> (benchmarked on 64 bit machines), which does return 64 bit numbers
>> on a 64 bit machine, and so far passed all randomness tests I ran
>> from the TestU01 suite (I didn't run the very time consuming
>> DieHarder test).
>
>Sure, any LCRNG that uses division isn't going to be fast.  A 64-bit
>computer can turn that modulo operation into a couple of
>multiplications, a shift, and a subtraction, but it's still not going
>to be fast.  2^31 - 1 is prime, so that's a much better choice for a
>modulus.

So to our consolation we can conclude that LC53 has probably a poor
price-performance ratio (We set out to prove that you get nowhere
without theory, right? ;-) ) This remains to be tested.

However performance is not the starting point.  It was ease of use for
novices.
A novice will do `` RAND 6 MOD 1+ '' for a dice roll, and gets disappointed
with most rng, as even and odd dice rolls alternate.
Not so with LC53 though.

Most Forth rng are complemented with a choose function
: CHOOSE RAND UM* DROP ;
This is proper for a choice from few alternatives like a dice roll,
but it is another thing for a novice to learn.

>
>Andrew.
-- 
Albert van der Horst, UTRECHT,THE NETHERLANDS
Economic growth -- being exponential -- ultimately falters.
albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst

[toc] | [prev] | [next] | [standalone]


#27045

FromAndrew Haley <andrew29@littlepinkcloud.invalid>
Date2013-11-28 09:10 -0600
Message-ID<_qqdnWzQEZtHwQrPnZ2dnUVZ_sWdnZ2d@supernews.com>
In reply to#27038
Albert van der Horst <albert@spenarnc.xs4all.nl> wrote:
> In article <eqKdnSUOWM1xtgrPnZ2dnUVZ_oednZ2d@supernews.com>,
> Andrew Haley  <andrew29@littlepinkcloud.invalid> wrote:
>>
>>Sure, any LCRNG that uses division isn't going to be fast.  A 64-bit
>>computer can turn that modulo operation into a couple of
>>multiplications, a shift, and a subtraction, but it's still not going
>>to be fast.  2^31 - 1 is prime, so that's a much better choice for a
>>modulus.
> 
> So to our consolation we can conclude that LC53 has probably a poor
> price-performance ratio (We set out to prove that you get nowhere
> without theory, right? ;-) )

Did we?

> This remains to be tested.

I don't think so.
 
> However performance is not the starting point.  It was ease of use for
> novices.
> A novice will do `` RAND 6 MOD 1+ '' for a dice roll, and gets disappointed
> with most rng, as even and odd dice rolls alternate.

But an LC generator mod 2^31 - 1 would be fine and doesn't involve a
division.  And so would an xor-shift generator.  In the end, bang for
the buck is what matters.

Andrew.

[toc] | [prev] | [next] | [standalone]


#27046

FromBernd Paysan <bernd.paysan@gmx.de>
Date2013-11-28 16:22 +0100
Message-ID<l77n30$7em$1@online.de>
In reply to#27031
Andrew Haley wrote:

> Bernd Paysan <bernd.paysan@gmx.de> wrote:
>> 
>> LC53 is a maximum period linear congruent random number generator -
>> so far, so good.  It has the usual problems of LCGs, so it doesn't
>> pass any serious randomness test suite.  It is certainly not worse
>> than others,
> 
> Did you really mean to say that?  All we know is that it is not
> certainly worse.  I doubt very much that a generator chosen without
> any theoretical justification or testing is as good as any.  It's not
> impossible, but it would be a fantastic stroke of luck.

Not really, the likelyhood to find a prime root is ~O(log^6 n), so there are 
really very, very many prime roots if n is just 2^32.

> Despite all of the theoretical work that has been done, I think it's
> still true that the best way to find a "good" LC generator is to
> search for one using an automated test procedure.

The theoretical work reduces the search time.  Maximum period is just one 
condition a LC generator must pass.  This is not enough, e.g. 2 is a prime 
root of 2^32-5.  2 would be a very bad choice for g, though.

>> but it definitely is slower than the mod 2^cellbits ones.  It is
>> just a bit faster as the hash-based PRNG I use in Gforth-git now
>> (benchmarked on 64 bit machines), which does return 64 bit numbers
>> on a 64 bit machine, and so far passed all randomness tests I ran
>> from the TestU01 suite (I didn't run the very time consuming
>> DieHarder test).
> 
> Sure, any LCRNG that uses division isn't going to be fast.  A 64-bit
> computer can turn that modulo operation into a couple of
> multiplications, a shift, and a subtraction, but it's still not going
> to be fast.

Actually, even a 32 bit computer can turn *that* particular modulo operation 
into two multiplications by 5, and some addition/subtractions.  (a*2^32+b) 
mod 2^32-5 = (b + a*5) mod 2^32-5.

Thus you only need to iterate this until it's smaller than 2^32-5.  The 
multiplication by 5 itself is pretty cheap, especially on architectures like 
x86, where you can use lea for that (be aware that you also need the higher 
order part, so you need a shift right by 30, too, and keep track of your 
carry!).

> 2^31 - 1 is prime, so that's a much better choice for a
> modulus.

Yes, Mersenne primes are quicker, because you don't need any further 
multiplication for the addition above: a*2^n+b mod 2^n-1 = b+a mod 2^n-1.  
For 64 bit systems, 2^61-1 is a Mersenne prime, and 2^127-1 is also one; 
with a prime root that is just 64 bit, you could do with 2 um*s to produce a 
LCRNG with a 2^127-1 period.

It will still have the other problems of LCRNGs, so if you want a high-
quality PRNG, don't use that approach.

-- 
Bernd Paysan
"If you want it done right, you have to do it yourself"
http://bernd-paysan.de/

[toc] | [prev] | [next] | [standalone]


#27047

FromAndrew Haley <andrew29@littlepinkcloud.invalid>
Date2013-11-28 09:34 -0600
Message-ID<99CdnSLzyb3x_wrPnZ2dnUVZ_sadnZ2d@supernews.com>
In reply to#27046
Bernd Paysan <bernd.paysan@gmx.de> wrote:
> Andrew Haley wrote:
> 
>> Bernd Paysan <bernd.paysan@gmx.de> wrote:
>>> 
>>> LC53 is a maximum period linear congruent random number generator -
>>> so far, so good.  It has the usual problems of LCGs, so it doesn't
>>> pass any serious randomness test suite.  It is certainly not worse
>>> than others,
>> 
>> Did you really mean to say that?  All we know is that it is not
>> certainly worse.  I doubt very much that a generator chosen without
>> any theoretical justification or testing is as good as any.  It's not
>> impossible, but it would be a fantastic stroke of luck.
> 
> Not really, the likelyhood to find a prime root is ~O(log^6 n), so
> there are really very, very many prime roots if n is just 2^32.

Sure, but there is a lot more to a quality linear congruential
generator than a maximum period.  Set a = c = 1 and you've got a full
period but a very bad generator.

Andrew.

[toc] | [prev] | [next] | [standalone]


#27058

Fromhughaguilar96@yahoo.com
Date2013-11-28 18:39 -0800
Message-ID<cbc7054a-3b9e-4a45-a71a-b0d63dc9c832@googlegroups.com>
In reply to#27046
On Thursday, November 28, 2013 8:22:08 AM UTC-7, Bernd Paysan wrote:
> > Sure, any LCRNG that uses division isn't going to be fast.  A 64-bit
> > computer can turn that modulo operation into a couple of
> > multiplications, a shift, and a subtraction, but it's still not going
> > to be fast.
 
> Actually, even a 32 bit computer can turn *that* particular modulo operation 
> into two multiplications by 5, and some addition/subtractions.  (a*2^32+b) 
> mod 2^32-5 = (b + a*5) mod 2^32-5.
> 
> Thus you only need to iterate this until it's smaller than 2^32-5.  The 
> multiplication by 5 itself is pretty cheap, especially on architectures like 
> x86, where you can use lea for that (be aware that you also need the higher 
> order part, so you need a shift right by 30, too, and keep track of your 
> carry!).

My original motivation for inventing LC53 was so I would have an LCG that was difficult to implement in C (without descending into assembly-language), but which would be easy to implement in ANS-Forth.

I wanted an LCG because my interest in the whole thing was to write an encryption-cracking program, and LCGs are the easiest to crack, so I expected that this would be a good introduction to crypto-analysis for me.

I only recommend using LCGs for games. My LC53 is okay for that, especially if you only need random numbers in a small range, so you are only using the upper bits of LC53 which are pretty random --- this is typical for games, because they don't need a lot of precision (they are mostly just moving images around on a small screen, after all).

There are many prngs that work a lot better than LCGs. In my language, I will make the prng a standard part of the language, so it will be written in assembly-language while yet being standard --- I'll most likely use Donald Knuth's 64-bit LCG from MMIX, as that is plenty fast, and it is adequate for simulation when only the upper 32-bits are used (which should be adequate for most simulations, as they don't require all that much precision either).

> > 2^31 - 1 is prime, so that's a much better choice for a
> > modulus.

The period for this is about half of the period for LC53, so it is about half as good. I could have used this for my encryption-cracking program though, as I wanted something fairly easy to crack.

The reason why I invented LC53 rather than use one of the common LCGs based on 2^31-1, is because I was at my father's ranch and he doesn't have internet access, and it was the weekend so I couldn't drive into town and use the library wifi, and my book on cryptography wasn't handy --- so I invested 2 hours on inventing my own --- but now I have invested more than 2 hours on this ridiculous thread...

[toc] | [prev] | [next] | [standalone]


#27006

Fromalbert@spenarnc.xs4all.nl (Albert van der Horst)
Date2013-11-27 16:44 +0000
Message-ID<52962162$0$594$e4fe514c@dreader34.news.xs4all.nl>
In reply to#26994
In article <5295e1b8$0$3182$e4fe514c@dreader36.news.xs4all.nl>,
Albert van der Horst <albert@spenarnc.xs4all.nl> wrote:
>In article <07bc57a5-4595-4c58-baac-169c10635c18@googlegroups.com>,
> <hughaguilar96@yahoo.com> wrote:
>>On Tuesday, November 26, 2013 2:38:09 PM UTC-7, Howerd wrote:
>>> On Monday, 25 November 2013 23:16:36 UTC, m...@iae.nl  wrote:
>>> >  [a lot of statistics]
>>>
>>> Thanks :-)
>>>
>>> H.
>>
>>This whole thread is joke, because none of us know anything about the
>>subject. Who cares about statistical analysis, if we don't know how the
>>LCG parameters are derived? This has been a remarkably lengthy thread,
>>without even a tiny flicker of intelligence yet...
>
>So you think that I edit a Wikipedia entry about a subject I don't
>know about? Actually that is an insult.


>
>>
>>I'll tell you how I invented LC53. I just set the size of the field to a
>>big prime number (2*32-5).
>
>You stumbled upon a method suggested by Knuth in TAO vol. 2.
>
>> Then I guessed at various multipliers until I
>>found one that provided a full period. I had a lucky guess early on, so
>>the whole invention only took about 1 or 2 hours.
>
>This can't be true. All multipliers except 0 and 1 give a full period.
>This is an elementary fact from number theory.

Egg on my face! Only primitive roots give a maximal period, of length
p-1 in this case. See my other answer.
So you remembered right that you may have tried a few.
What is not true that you've found a multiplier with a maximal period,
see the other post.

>Groetjes Albert
>--
>Albert van der Horst, UTRECHT,THE NETHERLANDS
>Economic growth -- being exponential -- ultimately falters.
>albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst
>
-- 
Albert van der Horst, UTRECHT,THE NETHERLANDS
Economic growth -- being exponential -- ultimately falters.
albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst

[toc] | [prev] | [next] | [standalone]


#26948

FromBernd Paysan <bernd.paysan@gmx.de>
Date2013-11-25 19:51 +0100
Message-ID<l70681$ag4$1@online.de>
In reply to#26941
Matthias Koch wrote:

> Bernd Paysan:
>> the German Wikipedia has even (relatively good)
>> variants for 32 and 64 bits:
>> 
>> http://de.wikipedia.org/wiki/Xorshift
> 
> \ Xorshift Random Number Generator, 32 Bits
> 
> 314159265 variable seed
> 
> : random ( -- x )
>   seed @
>   dup 13 lshift xor
>   dup 17 rshift xor
>   dup  5 lshift xor
>   dup seed !
> ;

If you want one that passes Diehard, take the 128 bit version.  The period 
of the 32 bit version is way too short to fool that test.

-- 
Bernd Paysan
"If you want it done right, you have to do it yourself"
http://bernd-paysan.de/

[toc] | [prev] | [next] | [standalone]


#26929

Fromhughaguilar96@yahoo.com
Date2013-11-24 11:13 -0800
Message-ID<4b0dead7-dd72-4762-bb2c-416a34b60bab@googlegroups.com>
In reply to#26926
On Sunday, November 24, 2013 7:17:27 AM UTC-7, Albert van der Horst wrote:
> In article <op.w61slwx45zc71u@localhost>,

> Hugh's novice thing is an honest effort. There may be flaws
> in theoretical underpinnings (discussions with Passaniti come
> to mind), as far as programming and documentation is concerned
> it is pretty solid.

You say this as if I am striving to obtain your praise, which you are willing to dribble out for me. I don't care if you think that my novice package is "pretty solid" --- because you yourself are about as solid as a marshmellow (and Passaniti and Payson's discussion of "theoretical underpinnings" was the same).

This reminds me of a private discussion I had with Jeff Fox:

I said:
"I think that a lot of people ... purposely promote Forth as a toy to avoid offending E.R. --- apparently they think that so long as Forth is alive, that is a good result, even if it is not being taken seriously by anybody --- the result is that Forth is like a zombie that lurches forward indefinitely without dying completely, but yet never shows any real sign of life."
 
Jeff said:
"I think there is a simpler explanation.  People who write those 1%
performance type Forth or the 0.1% type Forth are probably doing
the best they can.  Look at ciForth from Albert Vanderhorst.  It is
basically a FIG-FORTH copied from the 70s.  He promotes it because
he wrote it, it is his.   He also talks about his AI work which is basically
a disassembler."

I think that what I find most loathsome about people such as yourself, is that you pick up some work from somebody else, and then promote it as if it is your own. You just picked up an old FIG Forth and renamed it ciForth. This is the same thing that you are doing now --- promoting the "Numerical Recipes" prng as if it is your own. You actually don't have the slightest idea how those constants (the multiplier and additive) were originally derived, but you are capable of typing them in to your code, and there you go --- you become an instant expert!

This, of course, is also why I find Elizabeth Rather to be so loathsome. There is no evidence to indicate that she has ever written a program herself. She just picked up Charles Moore's program and made it her own. Same thing with Passaniti --- never wrote a program himself --- just read about Splay Trees and Hash Tables in some algortithms book and declared himself a big expert. All of you are total phonies.

Payson is another phony. He is promoting his "quotations" when they are just :NONAME with some syntactic sugar. He actually knows that a quotation is supposed to have access to the local variables in the creator function (that is what makes them useful), but he doesn't know how to implement quotations correctly, so he just fakes it.

Hans Bezemer says:
"Obviously, you can always argue that whatever solution I (or someone 
else) provide isn't CONSIDERED to be the real thing by Hugh Aguilar. But who 
cares? The issue of who considers what to be what is purely academic if one 
can't agree on definitions."

Hans and Elizabeth don't know what quotations are, but they are willing to accept any definition that anybody on the Forth-200x committee may offer. Bernd does know what quotations are though, but he just fakes it with a "dead easy" implementation that is useless, because he doesn't know how to implement them correctly. I was the only person other than Payson on the Forth-200x mailing list who knows that quotations are supposed to have access to the creator function's local variables, but Payson succeeded in getting me kicked off the Forth-200x mailing list for pointing out that his "quotations" fail to do this --- so now he is the sole expert on quotations on the Forth-200x committee, and he can continue to get his butt kissed by Hans etc. --- meanwhile, the real world is totally ignoring Forth-200x because in the real world people actually do care that things are done right. There is no disagreement on definitions --- basic computer-science concepts such as this have been well-known for many decades --- if you fake it and expect nobody to notice, the result will be that everybody will just ignore Forth-200x (which is exactly what has happened).

Most of the comp.lang.forth crowd are total phonies! I am concerned that this "may reflect poorly on the reputation of the Forth community."

[toc] | [prev] | [next] | [standalone]


#26938

FromHans Bezemer <the.beez.speaks@gmail.com>
Date2013-11-25 09:52 +0100
Message-ID<52930fef$0$15983$e4fe514c@news2.news.xs4all.nl>
In reply to#26929
hughaguilar96@yahoo.com wrote:

> Payson is another phony. He is promoting his "quotations" when they are
> just :NONAME with some syntactic sugar. He actually knows that a quotation
> is supposed to have access to the local variables in the creator function
> (that is what makes them useful), but he doesn't know how to implement
> quotations correctly, so he just fakes it.
> 
> Hans Bezemer says:
> "Obviously, you can always argue that whatever solution I (or someone
> else) provide isn't CONSIDERED to be the real thing by Hugh Aguilar. But
> who cares? The issue of who considers what to be what is purely academic
> if one can't agree on definitions."
> 
> Hans and Elizabeth don't know what quotations are, but they are willing to
> accept any definition that anybody on the Forth-200x committee may offer.
Oohhhh, that's a big rant. Really your style. Still, I stand by my quote:
gimme a definition. Note that quotations are not that universal. The only
true definition I found was at the Factor page. I quote (pun intended):

"Quotations consist of several words enclosed in square brackets; they can
be stored on the stack without being executed and passed as parameters to
combinators".

An embedded :NONAME definition does just fine (if you ignore the "square
brackets" part of the definition).

A closure, however, is defined like this:

"In programming languages, a closure (also lexical closure or function
closure) is a function or reference to a function together with a
referencing environment—a table storing a reference to each of the
non-local variables (also called free variables or upvalues) of that
function. A closure—unlike a plain function pointer—allows a function to
access those non-local variables even when invoked outside its immediate
lexical scope."

So, I think you're mixing up both concepts, which makes you the phony here.

Hans Bezemer

[toc] | [prev] | [next] | [standalone]


#26930

Fromhughaguilar96@yahoo.com
Date2013-11-24 13:07 -0800
Message-ID<eeb67c72-d51b-44e9-8d37-2dcfb42ecfae@googlegroups.com>
In reply to#26916
On Saturday, November 23, 2013 9:25:28 AM UTC-7, Albert van der Horst wrote:
> This may be a very poor generator, and it may reflect poorly on the
> reputation of the Forth community. It may give a wrong impression about
> the standing of Hugh's novice package in the Forth community.
> 
> I ask Hugh to remove the LC53 from the wikipedia entry...

Okay, you win! I removed the reference to LC53 from both the linear-congruential generator page, and the Lehmer page where somebody had referenced it. I also removed the reference to ASSOCIATION.4TH from the left-leaning red-black tree page. In every case, I cited the fact that it was original research as grounds for its removal. I'm not aware of any other mention of my software or myself on Wikipedia, but if you find any, tell me about it and I will remove those too. 

This is a total victory for Albert! First he got my goat and induced me to respond hastily to his post here on C.L.F., making a fool of myself because I thought he was promoting a prng with a 16-bit multiplier when it was actually 32-bit. Now he has succeeded in getting me to delete all reference to my novice package on Wikipedia, which he thinks reflects poorly on the reputation of the "Forth community" (which he apparently is the champion of).

[toc] | [prev] | [next] | [standalone]


#26936

Fromalbert@spenarnc.xs4all.nl (Albert van der Horst)
Date2013-11-25 02:18 +0000
Message-ID<5292b38b$0$3208$e4fe514c@dreader36.news.xs4all.nl>
In reply to#26930
In article <eeb67c72-d51b-44e9-8d37-2dcfb42ecfae@googlegroups.com>,
 <hughaguilar96@yahoo.com> wrote:
>On Saturday, November 23, 2013 9:25:28 AM UTC-7, Albert van der Horst wrote:
>> This may be a very poor generator, and it may reflect poorly on the
>> reputation of the Forth community. It may give a wrong impression about
>> the standing of Hugh's novice package in the Forth community.
>>
>> I ask Hugh to remove the LC53 from the wikipedia entry...

Full quote:
"
I ask Hugh to remove the LC53 from the wikipedia entry, until such
time he has more explanation on his website about the quality of the
generator.
"
You've seen Bernds comment. Congruential generators are not the state of
the art and can't stand the newest and thoughest tests.
This is widely recognized, and still they are widely used.
(E.g. ciforth's library contains a simple one, and I'm not going to
upgrade it.)
So as soon as you have an assesment on your website, I'll
add LC53 back on the wikipedia entry, if you're too modest to
do it yourself.

>
>........... original research .........................................

The original research rule in wikipedia is for when you publish a list
of US generals that knew about the My Lai massacre.
Not if you publish a fact or a technical result that can easily be checked
by anybody in the know.

>
<SNIPPED rant>

Instead of this why not doing some more programming, and publishing of
"original research". You know, not everybody is capable of doing that.

Groetjes Albert
-- 
Albert van der Horst, UTRECHT,THE NETHERLANDS
Economic growth -- being exponential -- ultimately falters.
albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst

[toc] | [prev] | [next] | [standalone]


#26937

Fromhughaguilar96@yahoo.com
Date2013-11-24 19:36 -0800
Message-ID<bbd30eb9-7bd9-4ef0-9b7b-968595c4387e@googlegroups.com>
In reply to#26936
On Sunday, November 24, 2013 7:18:51 PM UTC-7, Albert van der Horst wrote:
> So as soon as you have an assesment on your website, I'll
> add LC53 back on the wikipedia entry, if you're too modest to
> do it yourself.

I'm not going to put an assessment on my webpage. That is just troll bait --- trolls such as Marcel Hendrix and yourself will attack it, saying that I haven't proven that LC53 is very random and that LC53 fails various tests (randomness is a pretty slippery target, after all). Bernd will say that he read about some other prng in a book that is supposedly wonderful (it was a hardcover book, after all!), and that I "should" implement that instead. I don't really have the patience for this nonsense, so to hell with it --- and to hell with all of you too.

If you are so fired up to put a Forth implementation of an LC-prng in the Wikipedia LC-prng article, why don't you put this one in:

VARIABLE BUD 

: RAND  ( -- u )  BUD @  3141592621 *  1+  DUP BUD ! ; 

That comes from a "trusted source" (Wil Baden), it is used in a "program of some notoriety" (SwiftForth) --- and who could possibly have more "standing in the Forth community" than Elizabeth Rather? There you go!

Putting anything on Wikipedia is a waste of time. They have a strict rule against "original research," but everything that I do is original research, so that really excludes me from being a Wikipedia editor. I've already been through this with the slide-rule program. I tried to put a link to it in the External Links section of the slide-rule article, but an entire legion of trolls attacked me for it. I don't really have the patience for listening to non-programmers tell me that my program is trivial and that anybody could write it with a day's effort (their term was "arts and crafts"), so to hell with Wikipedia.

> Instead of this why not doing some more programming, and publishing of
> "original research". You know, not everybody is capable of doing that.

I originally wrote the novice package because I expected it to be used for writing Forth applications. Nobody is really writing Forth programs though. You just want me to upgrade the novice package so you can attack it. You have no intention of actually writing an application in Forth, either with or without the novice package. You started this thread because you were bored and wanted some attention --- well, congratufuckulations! --- you baited me and I responded, so it has been an entertaining weekend for you.

[toc] | [prev] | [next] | [standalone]


#26957

From"Ed" <invalid@invalid.com>
Date2013-11-26 12:57 +1100
Message-ID<l70vbc$95v$1@speranza.aioe.org>
In reply to#26916
Albert van der Horst wrote:
> ...
> This may be a very poor generator, and it may reflect poorly on the
> reputation of the Forth community.

Wikipedia doesn't claim to be truth or authority.  Entries are made by
individuals with all that implies.  If reputation be affected, it's their own.

The LCG in 'Starting Forth' is poor by most measures.  Despite huge
sales of the book, it rarely gets a criticism.  We accept simple RNG's
as being less than perfect.  LC53 will be better than some and worse
than others.

> I ask Hugh to remove the LC53 from the wikipedia entry, until such
> time he has more explanation on his website about the quality of the
> generator.

The appropriate (and less volatile) place for that discussion would be
Wikipedia itself.

With the possible exception of its creator, IMO it's of little consequence
what an individual posts about Forth.  An individual voice is easy to dismiss.
Much harder to ignore is what's done by formal committees in Forth's name.
The impact of that continues for decades and for all the world to see.  This
is what affects the reputation of Forth and its community more than any
Wikipedia entry.


[toc] | [prev] | [next] | [standalone]


#26993

Fromhughaguilar96@yahoo.com
Date2013-11-26 21:25 -0800
Message-ID<fcfa2d0d-7347-43a8-94af-fccfa0e3a5ef@googlegroups.com>
In reply to#26957
On Monday, November 25, 2013 6:57:32 PM UTC-7, Ed wrote:
> With the possible exception of its creator, IMO it's of little consequence
> what an individual posts about Forth.  An individual voice is easy to dismiss.

I agree. Posting code in a language reflects upon the programmer, not on the language. I don't think that the quality of SwiftForth reflects upon me as a Forth programmer.

Wikipedia itself is pretty easy to dismiss. Wikipedia is primarily used by high-school students trying to fake up some expertise on a subject that they know nothing about, so they will get an 'A' on their report from a teacher who also knows nothing about the subject (it takes 8 years of college to become a teacher, but it is all about teaching technique, and not about learning the subject).

Essentially all of those articles are just a weird jumble of buzzwords and academic-sounding nonsense. They appear to be impressive at first glance, but it is actually impossible to learn anything from them. The idea is to just paste that pseudo-intellectual blather into a school report to make it look impressive. Nobody actually cares about details such as whether any of that stuff actually works.

Notice how my LC53 jumped like a virus from the LCG article to the Lehmer article. Did anybody check to see that it worked before citing it? I doubt it. All of those editors routinely cite sources which they haven't read, or if they did read, didn't understand. Nonsense spreads throughout Wikipedia unchecked, and nobody cares. Nonsense spreads throughout the world too, most of it originating on Wikipedia or television, and it fills people's heads --- this eventually results in dementia.

> Much harder to ignore is what's done by formal committees in Forth's name.
> The impact of that continues for decades and for all the world to see.  This
> is what affects the reputation of Forth and its community more than any
> Wikipedia entry.

This is really the crux of the matter. If Bernd Payson was just a GForth programmer, then his failure to implement quotations would not be a problem --- GForth is just a toy, and it is not used for commercial development --- I can and do ignore GForth and ciForth and the myriad other bad Forth implementations. The problem is that Bernd is a member of the Forth-200x committee. When he fakes up his "quotations," and pretends that it is not necessary for them to have access to the creator function's local variables, then he drags all Forth-200x programmers down. This is really why I asked to be kicked off the Forth-200x mailing list --- I just don't want to be an ignoramus, which is what they require of everybody who uses Forth-200x --- I'll stick with being an "incurable troublemaker."

BTW: Do you know why quotations need access to the creator function's local variables? Can I have a show of hands, as to everybody reading this thread who knows the answer to this question? I really hope that I'm not the only one on C.L.F. who knows this basic concept --- that would be just too depressing.

[toc] | [prev] | [next] | [standalone]


#27005

Fromalbert@spenarnc.xs4all.nl (Albert van der Horst)
Date2013-11-27 15:48 +0000
Message-ID<5296144f$0$26887$e4fe514c@dreader37.news.xs4all.nl>
In reply to#26957
In article <l70vbc$95v$1@speranza.aioe.org>, Ed <invalid@invalid.com> wrote:
>Albert van der Horst wrote:
>> ...
>> This may be a very poor generator, and it may reflect poorly on the
>> reputation of the Forth community.
>
>Wikipedia doesn't claim to be truth or authority.  Entries are made by
>individuals with all that implies.  If reputation be affected, it's their own.

If I read an entry and it is wrong, I edit it. That is the responsible thing
to do. So every entry I've read is to an extent endorsed by me.
Multiply that by millions and you have it.
The results is that wikipedia contains truth and wields a lot of authority.

Groetjes Albert
-- 
Albert van der Horst, UTRECHT,THE NETHERLANDS
Economic growth -- being exponential -- ultimately falters.
albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst

[toc] | [prev] | [next] | [standalone]


#26995

FromMark Wills <markrobertwills@yahoo.co.uk>
Date2013-11-27 01:10 -0800
Message-ID<58796979-6dbf-4918-a8c7-abfb0d608101@googlegroups.com>
In reply to#26916
On Saturday, November 23, 2013 4:25:28 PM UTC, Albert van der Horst wrote:
>This may be a very poor generator, and it may reflect poorly on the
>reputation of the Forth community. It may give a wrong impression about
>the standing of Hugh's novice package in the Forth community. 

"This *may* be a very poor generator" - And it *may* be a very good generator. Did you test it?

"and it *may* reflect poorly on the reputation of the Forth community." - There again, it *may* not. Perhaps nobody actually cares. Did you solicit an opinion?

"It *may* give a wrong impression about the standing of Hugh's novice package in the Forth community." - Hmmm... Now we're getting down to the brass tacks of it. I wonder if this is simple envy, or if not, bias due to your personal dislike of Hugh. Whatever the reason, asking someone to remove an article over a bunch of "mays" is, with respect, quite rude, and I don't believe you should have done it. In fact I'll go further and state that, in my opinion, you should retract your request. Putting Hugh's contraversial presence and opinions on CLF to one side, you have produced no evidence in support of your request. Only a bunch of maybes. If your request was based on some sort of research "I tried Hugh's LC53, and actually it doesn't perform too well" then that would be a different matter entirely.

"There is no theoretical motivation or test results behind it" - and equally there are no test results backing up your assertion that it *may* be a poor algorithm. Just an opinion.

Respectfully.

[toc] | [prev] | [next] | [standalone]


#26997

FromAndrew Haley <andrew29@littlepinkcloud.invalid>
Date2013-11-27 03:29 -0600
Message-ID<o8ednSk74d31JgjPnZ2dnUVZ_hSdnZ2d@supernews.com>
In reply to#26995
Mark Wills <markrobertwills@yahoo.co.uk> wrote:

> Whatever the reason, asking someone to remove an article over a
> bunch of "mays" is, with respect, quite rude, and I don't believe
> you should have done it.

It is quite rude.  However, it also turned out to be correct in every
way.

> In fact I'll go further and state that, in my opinion, you should
> retract your request. Putting Hugh's contraversial presence and
> opinions on CLF to one side, you have produced no evidence in
> support of your request.

Plenty of other people have, though.

Andrew.

[toc] | [prev] | [next] | [standalone]


#27023

Fromhughaguilar96@yahoo.com
Date2013-11-27 19:49 -0800
Message-ID<e489ae8d-5001-4ffc-a19e-29399c3cddc3@googlegroups.com>
In reply to#26997
On Wednesday, November 27, 2013 2:29:12 AM UTC-7, Andrew Haley wrote:
> Mark Wills <markrobertwills@yahoo.co.uk> wrote:
> 
> > Whatever the reason, asking someone to remove an article over a
> > bunch of "mays" is, with respect, quite rude, and I don't believe
> > you should have done it.
> 
> It is quite rude.  However, it also turned out to be correct in every
> way.

Well, thanks for the support Mark --- finally somebody with some decency!

I had abandoned C.L.F. because it is just a platform for people to fake up expertise on subjects that they know nothing about (Bernd Payson's "quotations" being the last straw, because he was doing that as a representative of the Forth-200x committee, rather than just as a yahoo working with a bad Forth implementation that can be ignored). 

Then I got drawn back into C.L.F. with this thread because it was a direct attack on me. I shouldn't have responded at all though. The only result was that I removed the Wikipedia references to my LC53 and LLRB-tree code. I could have done that without comment --- the result would have been the same, with a lot less aggravation.

> > In fact I'll go further and state that, in my opinion, you should
> > retract your request. Putting Hugh's contraversial presence and
> > opinions on CLF to one side, you have produced no evidence in
> > support of your request.
> 
> Plenty of other people have, though.

Don't bother pressuring him to retract his request. I have already removed the Wikipedia references to my LC53 and my LLRB-tree code. I'm not going to put them back, even if Albert deigns to give them his "respectable" blessing. This is the same bozo who praises Elizabeth Rather for not writing any code, but instead delegating the work, which he considers to be confidence-inspiring --- his opinion isn't worth anything, pro or con.

Albert is just a typical Wikipedia troll though --- there are tens of thousands like him. There will always be some troll telling me that my code is "crap," and some other troll saying that this has turned out to be correct in every way --- that "plenty of people" have provided evidence that it is, in fact, "crap."

I've already been through this with trying to provide a link to my slide-rule image generator in the slide-rule article. One troll will attack it, saying that it is "arts and crafts." Then other trolls will join in on the fun. Pretty soon I've got a whole swarm of trolls attacking me like sharks in a feeding frenzy. For the trolls, smelling pride-of-accomplishment on a person, is like blood in the water --- they attack! --- pride-of-accomplishment is what they hate and fear the most in life.

Wikipedia has made the world worse rather than better. I am old enough to remember a time before Wikipedia existed --- there were trolls then too, but it wasn't an epidemic like it is nowadays. 

The whole thing is much ado about nothing. The only really dumb thing that you can do with an LCG is to design one that doesn't provide the full period (SwiftForth's). My LCG does have a full period however --- it took a few guesses, but I found a set of parameters that work. I also made my field size a prime number, which makes it more randomish than just using 2^32 as the size, although slightly slower (not that much slower though, as the modern x86 does division almost as fast as addition). My multiplier has no particular binary pattern, so I'm done --- like I said, the work of 1 or 2 hours. The LLRB tree took several days, but I didn't invent anything myself, so there isn't much pride-of-accomplishment at stake for me there. Wikipedia doesn't allow original research, so I can't post references to any of my code where I did invent something myself.

[toc] | [prev] | [next] | [standalone]


Page 3 of 4 — ← Prev page 1 2 [3] 4  Next page →

Back to top | Article view | comp.lang.forth


csiph-web