Comments (4)
Correct. I do not think it is a bijection so, indeed, if you try to generate 2^64 values, some values will occur more than once. However, 2^64 is an enormous number.
from wyhash.
Dear yuriev:
This good question has been discussed in a numpy thread. I would like to give a few commnets:
1: wyrand is too simple to be analyzed. it takes a 64 bit seed and return 64bit random number. This raised the question of bijection. In fact other PRNG uses 256 bit states/seed and return 64 bit random number. thus bijection is not a requirement of a valid PRNG. Or many valid PRNGs on the market is not bijective.
2: bijection is not good for PRNG. suppose we have a 3 bit PRNG, and it return 8 distinct numbers at 8 calls. When I am gambling, if I see the previous 7 numbers, the 8th number is determined with bijection assumption, I can bet all my money on the rest number.
3: when I do 2^64 sampling, it is natural to have 37% duplicate numbers. This is called "bootstrap" in statistics. zero duplicate is not a natral/random observation.
4: the BigCrush designers have better knowledge on statistical randomness than us. They work hard in order to crush poor PRNGs. We need to trust them. If bijection can be exploited, these guys will already do that for sure.
5: the last, you can test other modern PRNGs on the market, they will behave like wyrand in a statistical sense, eg. ~40% 16 bit duplicates.
I hope you are satisfied with my simple explainations.
Yours,
Yi
from wyhash.
Dear yuriev:
My additional thought confirms your worry. maybe I should restate that:
wyrand is of 32-bit strength/randomness
as wyrand's internal state is 64 bit, I guess it only has 32-bit randomness (something similar to birthday attack in hash). And BigCrush in fact is a 32-bit test. So if we trust BigCrush, we can at least claim 32-bit randomness.
However, I am not going return unsigned for wyrand, 64 bit return is still useful. But we should not apply it to large space, as some 64-bit numbers will never be generated.
Thank you very much! I am going to design a full 64-bit PRNG with 128-bit internal states.
from wyhash.
since mum
is symmetrical, the entropy of wyrand()
is at most 63. it is easy to find pair of seeds to return same first results:
uint64_t seed_a = time(NULL);
uint64_t seed_b = ((seed_a + _wyp[0]) ^ _wyp[1]) - _wyp[0];
But this do not influence the distribution of the output sequence. The real problem should be the internal state period has the nearly same bits with the output, so theoretically we could recover the all following sequence of 64-bit strings by just observing 2 iterations.
from wyhash.
Related Issues (20)
- v4 has even more bad seeds HOT 5
- Benchmark not measuring what you expect
- How do you use practrand? HOT 2
- License issue
- Using wyhash64 to mix numbers into prngs? HOT 5
- New release for wy_hash_final4?
- WyRand fails 64-bit 1-dimensional collision tests HOT 14
- Streaming hash HOT 1
- `make_secret` but for strings or other data
- Link to absl's wyhash implement seems to be changed. HOT 1
- WyRand64 (bit reversed) fails PractRand at 32TB HOT 3
- Question about wymum HOT 1
- Full round for every multiple 48-bytes, including last one HOT 1
- Secret seeds and primes HOT 4
- sprp and is_prime should be static inline?
- c-string optimized version?
- wy2u0k returns [1, k] instead of [0, k) when WYHASH_CONDOM=2
- wyhash election started HOT 1
- 是否可能给函数更多的熵 HOT 2
- Is wy2u01 mistakenly not making use of all 53 bits?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wyhash.