Article View: pl.comp.programming
Article #217536Re: Jak zrobić test za pomocą PractRand?
From: M.M.
Date: Mon, 23 Aug 2021 13:58
Date: Mon, 23 Aug 2021 13:58
128 lines
9545 bytes
9545 bytes
On Monday, August 23, 2021 at 3:21:47 PM UTC+2, osobli...@gmail.com wrote:
> poniedziałek, 23 sierpnia 2021 o 15:05:27 UTC+2 M.M. napisał(a):
> > On Monday, August 23, 2021 at 2:31:39 PM UTC+2, osobli...@gmail.com wrote:
> > > poniedziałek, 23 sierpnia 2021 o 11:18:03 UTC+2 M.M. napisał(a):
> > > > On Monday, August 23, 2021 at 5:23:14 AM UTC+2, osobli...@gmail.com wrote:
> > > > > Właściwie to mój generator oblewa po 16 MB:
> > > > >
> > > > > length= 16 megabytes (2^24 bytes), time= 2.1 seconds
> > > > >
> > > > > A ten LCG oblewa po 2 MB:
> > > > >
> > > > > length= 2 megabytes (2^21 bytes), time= 3.3 seconds
> > > > >
> > > > > Czyli mój radzi sobie chyba lepiej. O ile to ma w ogóle jakiekolwiek znaczenie, skoro testy prawdopodobnie nie są wykonywane poprawnie. Raczej wróżenie z fusów.
> > > > Jeśli użyłeś tego samego generatora co ja, tych samych stałych A i B, jeśli zainicjowałeś x=1, jeśli odrzuciłeś sto
> > > > początkowych wygenerowanych liczb (500 bitów), jeśli bierzesz tylko 5 najstarszych bitów - to powinno być tak samo jak
> > > > u mnie... chociaż ja mam wersję PractRanda 0.94 a Ty 0.93 - nie wiem czy zostało zmienione coś na tyle
> > > > istotnego aby wyniki testów były całkiem inne. Raczej w nowszej wersji testy powinny być bardziej surowe.
> > > >
> > > > Moje początkowe 1000 bitów wygląda tak:
> > > > ./SimpPRNG 1 1000
> > > > 1100010111000111110000011110101111001001011010001110001111001111000000001111100100010110111111100000111111101001001100000110110011001011101000100100110111011111001010111011011101001101100110001001111000101011000001000001110101101001111110111111000001011001011111100010101001010000000101111110000110010011100111101011010111110000100101100110100001110100000110101010001100010000011000111101110001110011111000101101110100110010110011011000001001101100011011011111100101000010110101110111011010111111100001101101011101011011100000100001110010011100010001101100011110011000100010011011001100010100010011110011101001010010000011010101000101111100100101110010011000001000001101101100110101110000101011010011110101101000100010110000000101001111110101110011001110001110110011110011101011101000001001001001100100111110111110110000110010101011011001100010100010111000010010100100100000011101010101001101001011101011110001000111000000000110000000101110000010110100110111011000100010101110000010010011001101000101
> > > >
> > > > Wyświetlam z tych 5 bitów począwszy od najmłodszego:
> > > >
> > > > https://github.com/mmarszik/SimpPRNG/blob/main/main.cpp
> > > > type_out v = r();
> > > > for( int k=0 ; k<bits && j<BUFF_SIZE && i<size ; k++, j++, i++ ) {
> > > > buff[j] = '0' + (v & 1);
> > > > v >>= 1;
> > > > }
> > > >
> > > > Ale na jakość generatora i zaliczenie testów nie powinno wpłynąć wyświetlanie od najstarszego.
> > > >
> > > > Początkowe liczby z tego generatora są statystycznie bardzo słabe jeśli inicjuje się małą liczbą
> > > > (np. jedynką), jest dużo zer na początku, warto odrzucić np. 100 początkowych generowań.
> > > >
> > > > Pozdrawiam
> > > Mam inne wyniki. Oto wyniki w formacie dziesiętnym:
> > >
> > > x = 1
> > >
> > > x = (x * 79908886691 + 8143076871913) & 340282366920938463463374607431768211455 = 8222985758604
> > >
> > > 8222985758604 >> 123 = 0
> > >
> > > x = (8222985758604 * 79908886691 + 8143076871913) & 340282366920938463463374607431768211455 = 657089637254136791211277
> > >
> > > 657089637254136791211277 >> 123 = 0
> > >
> > > x = (657089637254136791211277 * 79908886691 + 8143076871913) & 340282366920938463463374607431768211455 = 52507301369171109219924401511286320
> > >
> > > 52507301369171109219924401511286320 >> 123 = 0
> > >
> > > x = (52507301369171109219924401511286320 * 79908886691 + 8143076871913) & 340282366920938463463374607431768211455 = 333442790507095493699328894974793383801
> > >
> > > 333442790507095493699328894974793383801 >> 123 = 31
> > >
> > > x = (333442790507095493699328894974793383801 * 79908886691 + 8143076871913) & 340282366920938463463374607431768211455 = 225174366013576153541971350915313012980
> > >
> > > 225174366013576153541971350915313012980 >> 123 = 21
> > >
> > > Czyli uzyskuję:
> > >
> > > 0
> > > 0
> > > 0
> > > 31
> > > 21
> > >
> > > I tak dalej. Jak mogą tu wychodzić inne wyniki?
> > Jeśli nie ma błędów, to w tym przypadku nie można uzyskać innych wyników. Jeśli nie pomijam 100 początkowych
> > wygenerowanych liczb, to mam takie same liczby jak Ty:
> > 0
> > 0
> > 0
> > 31
> > 21
> > 4
> > 3
> > 9
> > 9
> > 7
> > 25
> > 12
> > 15
> > 16
> > 24
> > 11
> > 20
> > 14
> > 25
> > 27
> >
> > Jeśli pomijam to mam takie:
> >
> > 3
> > 29
> > 24
> > 7
> > 24
> > 11
> > 15
> > 18
> > 22
> > 24
> > 17
> > 7
> > 15
> > 0
> > 28
> > 19
> > 8
> > 27
> > 31
> > 0
> >
> > W wielu generatorach początkowe liczby uznawane są za kiepskie. Jeśli to jest ważne, pomija
> > się wiele początkowych liczb. Ten generator jest tylko do minimalnego sprawdzenia, ale jakoś
> > odruchowo pominąłem chociaż 100 początkowych liczb. Generalnie, pobieranie co N-tego bitu to
> > najprostsza technika zwiększająca jakość generatora - ale spowalniająca generator.
> Wychodzi nam to samo, myślałem, że pominąłem pierwsze 500 bitów, a pominąłeś 100. Oczywiście zdaję sobie sprawę z tych słabości początkowych bitów, sam projektowałem moje generatory, żeby unikać podobnych problemów. Niemniej mam przekonanie, że nawet bez pominięcia pierwszych bitów ten generator też dobrze by sobie poradził.
>
> Ale mniejsza z tym. Mamy te same generatory i ewidentnie problem jest z formatem danych.
Super, zawęziłeś obszar w którym jest problem :)
Pozdrawiam
Technical Details
Message-ID:
<c2aba592-62c0-4c20-b855-3441319f4585n@googlegroups.com>Path:
mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!fu-berlin.de!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mailReferences:
<6a2d60cf-5d52-4f70-a0bb-67ac51f2ea47n@googlegroups.com> <0b0e0278-0506-4691-8051-1f73a327e87an@googlegroups.com> <1aabf0e1-8c01-4479-90fc-62d1026d221cn@googlegroups.com> <fcda7316-c8b0-445b-a5d5-2c8db0e2c939n@googlegroups.com> <59524bbe-00b1-4756-b359-19bb000e8641n@googlegroups.com> <2aec1845-1ec1-4e83-835a-ccc9aa089c23n@googlegroups.com> <f201e244-08b1-4ec6-977a-40aba70eac76n@googlegroups.com> <48a87319-4f87-4ace-b9e1-e8c9842514can@googlegroups.com> <5af4b1e3-4d68-4ea8-a5cf-7d2b1075041cn@googlegroups.com> <680b4111-0c0b-4406-ae78-fc27fa1a545an@googlegroups.com> <efe0a67a-6b05-40d2-b877-e5a51f57dd9fn@googlegroups.com> <cb8e26f0-392e-4848-b573-e232e943b6f5n@googlegroups.com> <08cd0111-4022-41af-a03a-a3a4a6307ef6n@googlegroups.com> <c66ce87b-7302-4c87-813b-187c36feffd1n@googlegroups.com> <4a215489-d501-49d5-ade6-cf771ffee901n@googlegroups.com> <7ccd7613-9d6d-4d46-b68f-1db4e9d7a5e3n@googlegroups.com> <9082e2ac-cd7d-436d-80a8-7d12109d3297n@googlegroups.com> <227b1c0e-5d3c-4323-a374-de316aec2ffcn@googlegroups.com> <11f92832-5699-4cf9-be0d-412f9248f4den@googlegroups.com> <97a8c494-64a8-46c0-a17a-114d86aa94d9n@googlegroups.com> <d5976242-a26f-4b4a-93c0-49f7c056c46dn@googlegroups.com> <bf97ae93-0973-4e7d-a7dc-36e681b2479bn@googlegroups.com> <bdc239bf-9878-4a79-a5c4-e007aee2c279n@googlegroups.com> <f453f15f-4c3f-4eee-9714-850a0fb56161n@googlegroups.com> <03af61d9-e808-4daf-82b1-82e45f41372dn@googlegroups.com> <8c2590d8-1517-49f7-b95e-40e5fcaf830bn@googlegroups.com> <f341cef1-76f8-4aa4-ab18-ddf45ba038f3n@googlegroups.com> <a4f24c35-46a4-4dc4-90c0-fa9ee06ce740n@googlegroups.com> <bab05158-796a-4b3f-a52a-42659629ff42n@googlegroups.com> <268d32c4-3f2f-47cd-9544-d15a448f801cn@googlegroups.com> <c9a68c22-8a39-4c63-86e6-cb54d35bfde5n@googlegroups.com> <867ac372-f472-44ea-9346-d99449427a7fn@googlegroups.com> <a1e5bdaf-1701-420b-b2cf-f6831b771a92n@googlegroups.com> <df195a86-c889-47f3-9e9f-e2cb1828efc9n@googlegroups.com> <d2a0fb33-27b9-493e-a88c-fe2e8ec7624bn@googlegroups.com> <21f1661f-f0bc-40af-819b-67e491912f03n@googlegroups.com> <bede20ee-7292-489d-8159-c4460dd09ccdn@googlegroups.com> <1fcfa96a-47ba-4e47-8eea-f9df6a87099bn@googlegroups.com> <715772df-0454-47c9-8dba-ea9f1feb4f77n@googlegroups.com> <18a7e41b-e819-41dc-8749-f4073068d368n@googlegroups.com> <df4a2584-0ce2-4238-9ea2-611b7539a7cdn@googlegroups.com> <9d144f96-4b9c-4b36-b3d3-65f57d60f94cn@googlegroups.com> <585d821d-905b-4480-ae56-23162c4d697fn@googlegroups.com> <412e4c92-95f0-4066-874c-7bcaf7fdc527n@googlegroups.com>Show Full Headers
Complete Article Headers
X-Received: by 2002:a05:622a:1792:: with SMTP id s18mr18994qtk.136.1629727124533; Mon, 23 Aug 2021 06:58:44 -0700 (PDT) X-Received: by 2002:a05:622a:508:: with SMTP id l8mr1642902qtx.318.1629727124265; Mon, 23 Aug 2021 06:58:44 -0700 (PDT) Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!fu-berlin.de!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail Newsgroups: pl.comp.programming Date: Mon, 23 Aug 2021 06:58:44 -0700 (PDT) In-Reply-To: <412e4c92-95f0-4066-874c-7bcaf7fdc527n@googlegroups.com> Injection-Info: google-groups.googlegroups.com; posting-host=37.128.16.171; posting-account=xjvq9QoAAAATMPC2X3btlHd_LkaJo_rj NNTP-Posting-Host: 37.128.16.171 References: <6a2d60cf-5d52-4f70-a0bb-67ac51f2ea47n@googlegroups.com> <0b0e0278-0506-4691-8051-1f73a327e87an@googlegroups.com> <1aabf0e1-8c01-4479-90fc-62d1026d221cn@googlegroups.com> <fcda7316-c8b0-445b-a5d5-2c8db0e2c939n@googlegroups.com> <59524bbe-00b1-4756-b359-19bb000e8641n@googlegroups.com> <2aec1845-1ec1-4e83-835a-ccc9aa089c23n@googlegroups.com> <f201e244-08b1-4ec6-977a-40aba70eac76n@googlegroups.com> <48a87319-4f87-4ace-b9e1-e8c9842514can@googlegroups.com> <5af4b1e3-4d68-4ea8-a5cf-7d2b1075041cn@googlegroups.com> <680b4111-0c0b-4406-ae78-fc27fa1a545an@googlegroups.com> <efe0a67a-6b05-40d2-b877-e5a51f57dd9fn@googlegroups.com> <cb8e26f0-392e-4848-b573-e232e943b6f5n@googlegroups.com> <08cd0111-4022-41af-a03a-a3a4a6307ef6n@googlegroups.com> <c66ce87b-7302-4c87-813b-187c36feffd1n@googlegroups.com> <4a215489-d501-49d5-ade6-cf771ffee901n@googlegroups.com> <7ccd7613-9d6d-4d46-b68f-1db4e9d7a5e3n@googlegroups.com> <9082e2ac-cd7d-436d-80a8-7d12109d3297n@googlegroups.com> <227b1c0e-5d3c-4323-a374-de316aec2ffcn@googlegroups.com> <11f92832-5699-4cf9-be0d-412f9248f4den@googlegroups.com> <97a8c494-64a8-46c0-a17a-114d86aa94d9n@googlegroups.com> <d5976242-a26f-4b4a-93c0-49f7c056c46dn@googlegroups.com> <bf97ae93-0973-4e7d-a7dc-36e681b2479bn@googlegroups.com> <bdc239bf-9878-4a79-a5c4-e007aee2c279n@googlegroups.com> <f453f15f-4c3f-4eee-9714-850a0fb56161n@googlegroups.com> <03af61d9-e808-4daf-82b1-82e45f41372dn@googlegroups.com> <8c2590d8-1517-49f7-b95e-40e5fcaf830bn@googlegroups.com> <f341cef1-76f8-4aa4-ab18-ddf45ba038f3n@googlegroups.com> <a4f24c35-46a4-4dc4-90c0-fa9ee06ce740n@googlegroups.com> <bab05158-796a-4b3f-a52a-42659629ff42n@googlegroups.com> <268d32c4-3f2f-47cd-9544-d15a448f801cn@googlegroups.com> <c9a68c22-8a39-4c63-86e6-cb54d35bfde5n@googlegroups.com> <867ac372-f472-44ea-9346-d99449427a7fn@googlegroups.com> <a1e5bdaf-1701-420b-b2cf-f6831b771a92n@googlegroups.com> <df195a86-c889-47f3-9e9f-e2cb1828efc9n@googlegroups.com> <d2a0fb33-27b9-493e-a88c-fe2e8ec7624bn@googlegroups.com> <21f1661f-f0bc-40af-819b-67e491912f03n@googlegroups.com> <bede20ee-7292-489d-8159-c4460dd09ccdn@googlegroups.com> <1fcfa96a-47ba-4e47-8eea-f9df6a87099bn@googlegroups.com> <715772df-0454-47c9-8dba-ea9f1feb4f77n@googlegroups.com> <18a7e41b-e819-41dc-8749-f4073068d368n@googlegroups.com> <df4a2584-0ce2-4238-9ea2-611b7539a7cdn@googlegroups.com> <9d144f96-4b9c-4b36-b3d3-65f57d60f94cn@googlegroups.com> <585d821d-905b-4480-ae56-23162c4d697fn@googlegroups.com> <412e4c92-95f0-4066-874c-7bcaf7fdc527n@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <c2aba592-62c0-4c20-b855-3441319f4585n@googlegroups.com> Subject: Re: Jak zrobić test za pomocą PractRand? From: "M.M." <mmarszik@gmail.com> Injection-Date: Mon, 23 Aug 2021 13:58:44 +0000 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit