-
X-Received: by 10.31.174.75 with SMTP id x72mr811785vke.13.1512620123009; Wed, 06 Dec
2017 20:15:23 -0800 (PST)
X-Received: by 10.31.174.75 with SMTP id x72mr811785vke.13.1512620123009; Wed, 06 Dec
2017 20:15:23 -0800 (PST)
Path: news-archive.icm.edu.pl!news.icm.edu.pl!news.nask.pl!news.nask.org.pl!news.unit
0.net!peer01.am4!peer.am4.highwinds-media.com!peer01.iad!feed-me.highwinds-medi
a.com!news.highwinds-media.com!m31no538442qtf.0!news-out.google.com!v55ni1350qt
c.0!nntp.google.com!m31no538438qtf.0!postnews.google.com!glegroupsg2000goo.goog
legroups.com!not-for-mail
Newsgroups: pl.comp.programming
Date: Wed, 6 Dec 2017 20:15:22 -0800 (PST)
In-Reply-To: <p0a0td$1lis$1@gioia.aioe.org>
Complaints-To: g...@g...com
Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=159.205.34.244;
posting-account=xjvq9QoAAAATMPC2X3btlHd_LkaJo_rj
NNTP-Posting-Host: 159.205.34.244
References: <a...@g...com>
<a...@g...com>
<ovkuhb$abp$1@gioia.aioe.org>
<2...@g...com>
<a...@n...v.pl>
<7...@g...com>
<a...@n...v.pl>
<2...@g...com>
<f...@g...com>
<8...@g...com>
<p09f6j$ot4$1@gioia.aioe.org> <a...@n...v.pl>
<p0a0td$1lis$1@gioia.aioe.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <d...@g...com>
Subject: Re: Prosty generator pseudolosowy 8bit z limitem
From: "M.M." <m...@g...com>
Injection-Date: Thu, 07 Dec 2017 04:15:23 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Body-CRC: 3079262339
X-Received-Bytes: 8158
Xref: news-archive.icm.edu.pl pl.comp.programming:211860
[ ukryj nagłówki ]On Thursday, December 7, 2017 at 1:10:25 AM UTC+1, AK wrote:
> Użytkownik "slawek" <f...@f...com> napisał:
> >> rand() & 0xFF // ;)
> >
> > Lepiej (rand() >> 4) & 0xff
> >
> > Najniższe bity wywalić.
>
> To prawda, ale oni chcieli "szybciej", a nie "lepiej" :)
> PS: Oczywiscie generalnie to byl zart (no nie tak znow w 100%:)
>
> AK
Zwykły liniowy też może nieźle przechodzić diehardera, ale ma
operację modulo na uint64, więc nie działa super szybko:
#include <cstdio>
#include <cstdlib>
#define N (1000)
unsigned int frand() {
static unsigned long long x = 3456;
return x = ( 67867967ull * x + 373587883ull ) % 22801763489ull;
}
int main(int argc, char *argv[]) {
while( true ) {
unsigned char x[N];
for( int i=0 ; i<N ; i++ ) {
x[i] = (unsigned char)( ( frand() >> 12 ) & 0xff );
}
fwrite( x , 1 , N , stdout );
}
return 0;
}
time ./frnd | dieharder -a -m 1 -g 200
#===================================================
==========================#
# dieharder version 3.31.1 Copyright 2003 Robert G. Brown #
#===================================================
==========================#
rng_name |rands/second| Seed |
stdin_input_raw| 2.08e+07 |2780121314|
#===================================================
==========================#
test_name |ntup| tsamples |psamples| p-value |Assessment
#===================================================
==========================#
diehard_birthdays| 0| 100| 100|0.46063422| PASSED
diehard_operm5| 0| 1000000| 100|0.31333531| PASSED
diehard_rank_32x32| 0| 40000| 100|0.93698626| PASSED
diehard_rank_6x8| 0| 100000| 100|0.91729484| PASSED
diehard_bitstream| 0| 2097152| 100|0.88623878| PASSED
diehard_opso| 0| 2097152| 100|0.04569037| PASSED
diehard_oqso| 0| 2097152| 100|0.67464303| PASSED
diehard_dna| 0| 2097152| 100|0.11851483| PASSED
diehard_count_1s_str| 0| 256000| 100|0.99351326| PASSED
diehard_count_1s_byt| 0| 256000| 100|0.27087944| PASSED
diehard_parking_lot| 0| 12000| 100|0.48712953| PASSED
diehard_2dsphere| 2| 8000| 100|0.71869890| PASSED
diehard_3dsphere| 3| 4000| 100|0.06056982| PASSED
diehard_squeeze| 0| 100000| 100|0.12027489| PASSED
diehard_sums| 0| 100| 100|0.03918554| PASSED
diehard_runs| 0| 100000| 100|0.79798093| PASSED
diehard_runs| 0| 100000| 100|0.70611138| PASSED
diehard_craps| 0| 200000| 100|0.72556415| PASSED
diehard_craps| 0| 200000| 100|0.91109206| PASSED
marsaglia_tsang_gcd| 0| 10000000| 100|0.10109988| PASSED
marsaglia_tsang_gcd| 0| 10000000| 100|0.39278261| PASSED
sts_monobit| 1| 100000| 100|0.99866272| WEAK
sts_runs| 2| 100000| 100|0.52353357| PASSED
sts_serial| 1| 100000| 100|0.49463645| PASSED
sts_serial| 2| 100000| 100|0.23074460| PASSED
sts_serial| 3| 100000| 100|0.53546328| PASSED
sts_serial| 3| 100000| 100|0.86112117| PASSED
sts_serial| 4| 100000| 100|0.85038482| PASSED
sts_serial| 4| 100000| 100|0.67397315| PASSED
sts_serial| 5| 100000| 100|0.60585098| PASSED
sts_serial| 5| 100000| 100|0.54968851| PASSED
sts_serial| 6| 100000| 100|0.99277070| PASSED
sts_serial| 6| 100000| 100|0.68076764| PASSED
sts_serial| 7| 100000| 100|0.60350923| PASSED
sts_serial| 7| 100000| 100|0.16223947| PASSED
sts_serial| 8| 100000| 100|0.44079302| PASSED
sts_serial| 8| 100000| 100|0.27416319| PASSED
sts_serial| 9| 100000| 100|0.58490231| PASSED
sts_serial| 9| 100000| 100|0.49073425| PASSED
sts_serial| 10| 100000| 100|0.98547876| PASSED
sts_serial| 10| 100000| 100|0.61975871| PASSED
sts_serial| 11| 100000| 100|0.83174032| PASSED
sts_serial| 11| 100000| 100|0.74740837| PASSED
sts_serial| 12| 100000| 100|0.04825508| PASSED
sts_serial| 12| 100000| 100|0.34237994| PASSED
sts_serial| 13| 100000| 100|0.25836505| PASSED
sts_serial| 13| 100000| 100|0.54657267| PASSED
sts_serial| 14| 100000| 100|0.53319336| PASSED
sts_serial| 14| 100000| 100|0.66858312| PASSED
sts_serial| 15| 100000| 100|0.17449009| PASSED
sts_serial| 15| 100000| 100|0.36364894| PASSED
sts_serial| 16| 100000| 100|0.74664519| PASSED
sts_serial| 16| 100000| 100|0.61780527| PASSED
rgb_bitdist| 1| 100000| 100|0.62404389| PASSED
rgb_bitdist| 2| 100000| 100|0.76697955| PASSED
rgb_bitdist| 3| 100000| 100|0.33500938| PASSED
^C
real 8m36.320s
user 11m9.300s
sys 0m13.596s
Następne wpisy z tego wątku
Najnowsze wątki z tej grupy
- 7. Raport Totaliztyczny: Sprawa Qt Group wer. 424
- TCL - problem z escape ostatniego \ w nawiasach {}
- Nauka i Praca Programisty C++ w III Rzeczy (pospolitej)
- testy-wyd-sort - Podsumowanie
- Tworzenie Programów Nieuprzywilejowanych Opartych Na Wtyczkach
- Do czego nadaje się QDockWidget z bibl. Qt?
- Bibl. Qt jest sztucznie ograniczona - jest nieprzydatna do celów komercyjnych
- Co sciaga kretynow
- AEiC 2024 - Ada-Europe conference - Deadlines Approaching
- Jakie są dobre zasady programowania programów opartych na wtyczkach?
- sprawdzanie słów kluczowych dot. zła
- Re: W czym sie teraz pisze programy??
- Re: (PDF) Surgical Pathology of Non-neoplastic Gastrointestinal Diseases by Lizhi Zhang
- CfC 28th Ada-Europe Int. Conf. Reliable Software Technologies
- Młodzi programiści i tajna policja
Najnowsze wątki
- 2024-12-11 Aku LiPo źródło dostaw - ktoś poleci ?
- 2024-12-11 Warszawa => Specjalista Bezpieczeństwa Informacji <=
- 2024-12-11 Wrocław => Application Security Engineer <=
- 2024-12-11 Warszawa => Analyst in the Trade Development department (experience wi
- 2024-12-11 Lublin => Programista Delphi <=
- 2024-12-11 Motodziennik #305 Nowy ELEKTRYK za 350 złotych miesięcznie? Kreatywne kredytowanie problemów
- 2024-12-11 Warszawa => Spedytor Międzynarodowy <=
- 2024-12-11 Katowice => Key Account Manager (ERP) <=
- 2024-12-11 Katowice => Regionalny Kierownik Sprzedaży (OZE) <=
- 2024-12-11 Idzie zima...czyli zaczynamy TETRIS :)
- 2024-12-11 Warszawa => Analityk w dziale Trade Development (doświadczenie z Powe
- 2024-12-11 Warszawa => Full Stack web developer (obszar .Net Core, Angular6+) <=
- 2024-12-11 Warszawa => Full Stack .Net Engineer <=
- 2024-12-11 Dyski HDD SATA 2,5'' >2TB
- 2024-12-11 Warszawa => Architekt rozwiązań (doświadczenie w obszarze Java, AWS