Giter Club home page Giter Club logo

physical-rng's Introduction

随机数后处理算法仿真研究

算法

Reversed XOR

Reversed XOR + mLSB

Differentiation

选取两路独立同分布的做差,可以使得分布关于0对称(i.i.d随机变量X、Y的分布关于0对称)。向右移128即可使得得到的分布关于128对称。这样的话第八位的bias就会为0。

性能指标

Bias

我们要生成均匀分布的8位数序列,那么每个位都应该服从$p=0.5$的伯努利分布。我们定义一个位$x_i$的bias为$\bar x_i$偏离$0.5$的程度,也就是$Bias(x_i) = |\bar x_i - 0.5|$。

实验

使用NumPy生成的高斯噪声测试不同的算法

下面是不同情况下的测试结果,可以看到,当分布参数$\mu$不为128时,高位有比较大的bias,而当$\mu$正好为128时,高位的bias很小,而其他位的bias比较大。

$\text{Gaussian distribution}, \mu=90, \sigma=30$:

$\text{Gaussian distribution}, \mu=120, \sigma=40$:

$\text{Gaussian distribution}, \mu=128, \sigma=40$:

结论:可以看到,Reversed XOR确实改善了不同位的bias不均衡的问题,但是取mLSB似乎不论m为多少时都对bias没有太大的影响。另外,Reversed XOR对于bias没有明显的降低。

physical-rng's People

Contributors

pascalzh avatar

Watchers

 avatar

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.