Giter Club home page Giter Club logo

Comments (5)

wangyi-fudan avatar wangyi-fudan commented on July 18, 2024

yes. you can fix one parameter as seed and use another one as counter.
eg:
for(size_t i=0; i<100; i++) wyhash64(seed,i);

more:
for(size_t i=0; i<100; i++) for(size_t j=0; j<100; j++) wyhash64(i,j);

more:
for(size_t i=0; i<100; i++) for(size_t j=0; j<100; j++) wyhash64(seed, (i<<32)|j);

This algorithm can bee ported to GPU and cuda and serves as a parallel PRNG.
global void dropout(float *inp float out, uint64_t seed){
uint64_t id=blockIdx.x
blockDim.x+threadIdx.x;
if(wyhash64(seed,id)&1) out[id]=inp[id];
else out[id]=0;
}

from wyhash.

smcallis avatar smcallis commented on July 18, 2024

Excellent, thank you. I actually need 4 independent streams so I wrote up a quick test harness to write them out interleaved and passed them to BigCrush and PractRand. I used these four values as seeds:

seed[0]: 0x78a236743da49cb
seed[1]: 0xddfac0f2bb9a0fc7
seed[2]: 0x57d60387d2570f66
seed[3]: 0x404ce50a76d36e08

And they passed all the BigCrush tests and 4TB and counting of PractRand.

from wyhash.

smcallis avatar smcallis commented on July 18, 2024

Last question: is wyhash64 reversible? Thus collision free?

from wyhash.

wangyi-fudan avatar wangyi-fudan commented on July 18, 2024

no, it is not reversible nor collision free. However, as a 64 bit PRNG, the space is so large, you can safely use it as BigCrush and Practrand are PRNG standard. More words are: collision is true random but collision free is not true random... Imagine I have a dice to bet with you. You observed 5 rolls: 1,2,3,4,5. If you know the dice is collision free, you can bet on 6 with all your money. But if it is not collision free, it is still fair.

from wyhash.

smcallis avatar smcallis commented on July 18, 2024

Ok that makes sense, as long as it's deterministic that's my important criteria =D

from wyhash.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.