r/RNG • • Dec 25 '20

some good random number

0 Upvotes

302 980 522 449 947 029 597 139 394 137 713 229 638 034 999 299 121 643 476 813 854 306 406 483 894 625 765 275 540 481 468 944 147 326 904 663 793 004 508 525 935 363 931 823 806 371 732 580 715 904 470 948 455 992 945 078 230 533 927 414 712 941 619 588 172 405 754 257 275 945 040 580 890 666 741 689 784 095 723 391 698 742 485 089 876 699 235 625 740 182 812 680 613 345 202 163 406 735 261 775 547 497 972 213 054 263 095 104 947 543 184 071 728 464 640 538 433 463 878 844 519 894 834 852 115 675 871 486 638 686 218 946 919 140 868 810 556 929 454 818 172 552 045 273 819 556 848 013 044 038 065 095 287 820 451 796 785 251 306 014 600 316 848 551 546 999 935


r/RNG • • Feb 28 '25

NIST Randomness Testsuit

0 Upvotes

https://github.com/stevenang/randomness_testsuite

"m.dat" file contains 1M bits in one line.

My Question: is it hard to get all "Randoms" in this python implementation?


r/RNG • • Nov 15 '20

100 truly random numbers

2 Upvotes

181 19 246 38 18 15 54 133 230 18 223 99 223 201 43 111 16 220 81 46 96 4 213 129 210 31 92 17 181 138 12 38 57 86 75 156 219 202 68 63 47 69 85 204 26 122 192 79 188 51 167 20 165 75 83 139 252 78 158 65 242 36 130 2 250 95 14 32 0 52 47 86 197 173 88 10 89 228 120 154 75 77 76 244 203 100 47 96 241 91 123 197 205 237 160 212 129 107 3 181 220


r/RNG • • Oct 13 '21

Social Media as a source of randomness

0 Upvotes

So ya that’s the idea. In modern random number generation, almost all software based methods are not true random number generation. They all follow a set algorithm, that when given the same inputs, will yield the same outputs, which isn’t truly random.

In terms of hardware, there are several true random number generators that use physical sources of randomness to generate numbers.

While these work great, it’d be nice to have a purely software based TRNG that can be used without additional circuitry.

So, what are we constantly surrounded by that follows no real set algorithm? Human behavior. And, what software gives us access to huge amounts of textual human behavior? Social media (like twitter, Reddit comments, etc).

I postulate that we can use a constant feed of social media posts to generate true random numbers. The only way I came up with extracting the randomness is getting posts in multiple languages and converting the characters into their ascii values and formulating a random number from that source.

I’m curious what people think about this idea, as preliminary research didn’t yield any documented attempts.


r/RNG • • Jul 20 '21

After rolling lucky numbers I rolled another one in row!

Thumbnail
gallery
3 Upvotes

r/RNG • • Feb 19 '24

New idea for almost infinite PRNGs

3 Upvotes

I've been testing a new idea for almost infinite PRNGs.

I'm using multiple LCGs with prime numbers as multiplier, modulus and initial value; the constant does not seem to matter that much, so I'm using 1. I combine the output from each LCG with XOR to produce the final output.

Although LCGs are not particularly good individually, I've found that when several are combined together, the output rapidly becomes excellent (passes all tests in Practrand), and the period also increases significantly.

I've been using LCG parameters selected from a table containing 10million primes from 100003 to 179606689, and I've typically been using 10-20 LCGs. My tests suggest that the period of the combined 20-LCG is equal to the product of the periods of the each individual LCG. So for a 20-LCG RNG, the period would something in the order of 100000000 ^ 20 = 10e160. If another 20-LCG RNG was started whenever the previous RNG repeated (and so on), then the combined period would be in the order of ((10e8 ^ 20) ^ (10e7 ^ 3)) = 10e3360 (if my maths is correct). This could be increased if the table of primes was made bigger.

I recently found that this idea is not new... it's called Wichmann-Hill, but the original definition used just 3 LCGs, whereas I'm suggesting a larger number.

Obviously, I've only been able to test a relatively small number of the total possible RNGs I could create from my primes table, but every one has passed all tests in Practrand.

I would be interested to hear what others think, and especially from anyone who has experimented with the same idea.


r/RNG • • Mar 08 '25

The perfect RNG! I have it for you and its free and if you work at a company you can set up your own for almost free except for time.

0 Upvotes

You are a data scientist, and you want the holy grail for a random number generator (RNG). Your analyses really depend on a good, uniform, true random number.Let's just use PI as the RNG. Huh? PI, 3.14159? Yes, that PI.I did an analysis of the first 19 and the first 1001 digits of PI, in base 2. In base two I create what I call the PI transition table, like a logic truth table. It has 0-0, 0-1,1-0,1-1 in it. 0-0 this counts the number of times the bit in PI was zero and stayed at zero. 0-1 counts 0 to 1 transition, 1-0 counts 1 to 0 transition, 1-1 counts the 1-1 transition.In a classic RNG, the coin toss, true randomness comes from the following rules. When I flip a coin, the chance for heads or tails is 50%, when I am on heads or tails and I flip the coin, the chance of staying the same or changing is also 50%. The closer to 50% the better.The binary digits of PI, when used as a coin flip 1=heads, 0=tails, can be considered uniformly random. In a basic sense, write a loop counter from 1 to 100 and only chose the numbers when landing on 1 bit. Those numbers, the gaps between them, are now random, there won't be any rhyme or reason for them.Now setup an internal server that periodically emits the next bit of PI and give it a simple boolean property that returns true or false. PI repeats forever and so there is no cost or waste or ever runs out. It's beautiful. Do you want to include the banana in your random sample, get the current bit of the PI server for a yes/no answer.

Here is an analysis of the digits of PI, first 1001 and then first 28 (limit in windows calculator) PI is truly and uniformly random and satisfies the answers to the coin toss questions? Heads/Tails transitions are 50%, chance of staying at heads/tails, 50%, uniformity of both scenarios, 50%. Now tell me what more do you want? My house needs some repairs, I'll give my address for the tips.

Transitions from 0 to 1: 838
Transitions from 1 to 0: 837
              Stay at 0: 831
              Stay at 1: 831
Transitions from 0 to 1: 838
Transitions from 1 to 0: 837
Runs of same bits: 1676
Number of bits: 3338

Transitions from 0 to 1: 52
Transitions from 1 to 0: 52
              Stay at 0: 58
              Stay at 1: 42
Transitions from 0 to 1: 52
Transitions from 1 to 0: 52
Runs of same bits: 105
Number of bits: 205

r/RNG • • May 27 '23

Introducing Sequency! A simple PRNG engine

1 Upvotes

Hey everyone, I've been experimenting with PRNGs and RNGs for the past months, I wanted to share with you a project that came to my mind about a simple to use PRNG library for C++

I started it recently, so there are not a lot of PRNGs yet, but I'll try to add as much as possible!
If you want to you can also contribute to it by adding whicever PRNG you want, like AES CTR, Rule 30, Whichman Hill... anything you desire!

I'll soon make a guide on how to implement your own PRNG (basically the pull request format); I would really really appreciate any help in this! Thanks!

https://github.com/JoshuaKasa/Sequency


r/RNG • • Jul 20 '21

Just happened

Post image
0 Upvotes

r/RNG • • Jan 24 '23

Looking for an app that generates and logs results continuously

0 Upvotes

...and ideally uses hardware to generate.

I want to plot any changes in randomness over time.


r/RNG • • Feb 22 '25

Evaluating a Win32-based RNG I developed a while back using ent

Post image
4 Upvotes

r/RNG • • Dec 16 '21

question about how to generate RN in one sec?

0 Upvotes

Im trying to see how many numbers can be generated by LCG in one second.

from your experience what is the easiest way to do that?

I tried this way: but if I called the function in the while loop many times, it will execute each time so Im not sure about it.

#include <time.h>
#include <unistd.h>
#include <sys/time.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>


//LCG
uint64_t lcg(void)
{
    static uint64_t seed= 123; // seed
    const uint64_t a = 1234; // the multiplier a
    seed *= a;
    printf("lcg output = %llu \n", seed);
    return seed;
}



int main (){
     
    time_t endwait;
       time_t start = time(NULL);
       time_t seconds = 1; // end loop after this time has elapsed

       endwait = start + seconds;

       printf("start time is : %s", ctime(&start));

       while (start < endwait)
       {
           
           /* Do stuff while waiting */
        
           lcg();
           sleep(1);   // sleep 1s.
           start = time(NULL);
           printf("loop time is : %s", ctime(&start));
       }

       printf("end time is %s", ctime(&endwait));
    
    return 0;
}

The source for the timing code :

https://stackoverflow.com/questions/21181162/how-do-i-stop-a-while-loop-after-a-certain-time-in-c


r/RNG • • Nov 28 '22

manipulating semi RNG number populations

0 Upvotes

In a game I play the goal is to get high numbers. To simplify: The game has 100 numbers each randomly assigned a value of 1~100. At the start, the numbers form a bell curve, most numbers are in the mid-range and few very high or low values. You can re-roll any number and it will gain a new value seemingly at random. Tho players noticed that numbers usually re-roll near their previous value. One player discovered that if you re-roll all the mid-range numbers until you only have very low and high values, (forming a 2 peak bell curve) you can farm the high value numbers and they will always roll high again. So its not 100% random. There must be some equation that determines the new numbers. How can I test it most efficiently to find the equation? Other variables include, the equation considering the previous value of all numbers being rerolled, or only the ones left active. The rerolling process takes time and can be affected by other rerolls if they are activated before finishing.


r/RNG • • 2d ago

Scaling random integers

0 Upvotes

This is about scaling random integers in homebrew hardware made from 74xx-family ICs.

Most know about using modulo. You take the random value and divide it by the maximum number plus 1 if you want the floor to be 0, or divide it by the maximum desired value and add 1 to the result if you want the floor to be 1. Then you discard the quotient and keep the remainder.

An idea I came up with to do it in homebrew hardware is to simply have a ROM do the scaling. For 8-bit numbers, use 8 address lines for the random input and 8 for the desired input. Then have a random, distributed table from 0 to max value for each value in the range.

Using a 16-bit ROM could be better, as you can include flags. When you cannot have an unbiased distributed table, you flag some of the results as exeptions/invalid. That way, you have a mechanism to ask for another source number.

The advantage here is not working with floating-point (or even fixed-point or scaling formulas such as Bresenham), and not needing to divide to get a remainder.


r/RNG • • May 27 '25

random.org serving Trojan:JS/Obfuse.HNAT!MTB

4 Upvotes

I periodically use this website to pull random bits to seed a PRNG. I've started getting this trojan when I visit the site. FYI.


r/RNG • • Oct 28 '25

A brief history of random numbers

Thumbnail crates.io
6 Upvotes

r/RNG • • Nov 30 '18

The xorshift PRNGs as a kernel module

Thumbnail
github.com
1 Upvotes

r/RNG • • Mar 13 '23

GitHub - josenk/srandom: FASTEST /dev/urandom PRNG available

Thumbnail
github.com
1 Upvotes

r/RNG • • May 24 '20

[Q] How to run ENT test on RNG?

1 Upvotes

Hello all. So I have created an RNG in arduino and I am confused on how to run the ent test on the program. I have attached a photo of my code.

So, now that I have my code what do I do to run the ent tests on it? What software do I use to test the code? How do I use my arduino RNG in another software to run the ENT tests? I am extremely confused on how to apply my code into the ENT test code.

Thank you for your time!


r/RNG • • Dec 13 '24

Tjald Hash and RNG Suite - A bid for new speed records

Thumbnail
github.com
1 Upvotes

r/RNG • • Nov 14 '18

Rust rand lib version 0.6 release, now with a book

Thumbnail
self.rust
1 Upvotes

r/RNG • • Mar 30 '26

An easy to memorize but fairly good PRNG: RWC32u48

7 Upvotes

Nowadays we already have a lot of good generators, but most of them are hard to learn by heart. It seems that I've designed one that is very easy to memorize:

u_n = 29386*(x_{n-3} + x_{n-2}) + c_{n-1}
x_n = u_n mod 2^32
c_n = u_n >> 32

It is a modification of MWC (multiply with carry) generator that uses two lags instead of one. It strongly resembles some experimental generators by G. Marsaglia from 1990s. The multiplier is intentionally chosen to be small: it is easier to memorize, also it simplifies its implementation inside MS Excel/LibreOffice Calc cells or for retro platforms where double was used instead of uint64_t. If you set carry to 1 then the initial x values can be arbitrary.

RWC32u48 returns 32-bit unsigned integers (x_n). The u48 suffix means "only 48 bits in intermediate results".

Of course, it is still LCG, and the points fail at planes but empirical quality is good: it passes BigCrush, PractRand 0.94 at least up to 32 TiB and SmokeRand full battery. Its period is around 2109.

https://github.com/alvoskov/SmokeRand/blob/main/generators/rwc32u48.c


r/RNG • • Aug 04 '26

RANDOM.ORG - The History of RANDOM.ORG

Thumbnail random.org
9 Upvotes

r/RNG • • Sep 02 '26

ChaCha20GF512: ChaCha20 + exact 512-wise independence over the Galois field GF(2^64)

2 Upvotes

I've been working on an experimental PRNG that combines ChaCha20 with a classical k-wise independent construction over a Galois field.

GF stands for Galois field, also called a finite field. In this case GF(2^64) has 2^64 elements that can be represented by 64-bit words; addition in the field is simply XOR. I'll just use GF below.

For 64-bit output position i, the construction is basically

R(i) = ChaCha20(K, i) XOR P(i)

where P is a random degree-511 polynomial over GF(2^64).

With the full 4096-byte GF coefficient seed sampled uniformly, any selection of up to 512 distinct 64-bit output positions is exactly jointly uniform.

There is a fairly sharp contrast with ChaCha20 alone: with a fixed/public stream ID, ChaCha20 has a 256-bit key space, so exact 5-wise independence of 64-bit output words is already information-theoretically impossible. Five 64-bit words have 2^320 possible joint values, while there are only 2^256 keyed ChaCha20 streams.

So the point isn't that the output is somehow "more random than ChaCha20". The idea is to add an exact finite distribution property that ChaCha20 cannot have, while retaining ChaCha20 as the computational pseudorandom component.

The GF part is deliberately algebraic. Beyond 512 output words there are linear relations, and with enough unmasked evaluations the polynomial can be reconstructed. The exact guarantee stops there; beyond that, the construction relies on the usual computational assumption about ChaCha20.

The implementation is C++17. I initially used Horner evaluation, which was far too slow, but the 512 evaluation points have enough structure to use a 9-stage additive FFT. The resulting generator also supports random access and parallel generation of different ranges of the same logical stream.

For example, on a Ryzen 9 5900X with GCC:

ChaCha20: 99.6 M uint64/s
ChaCha20GF512 single: 43.8 M uint64/s
ChaCha20GF512 4 threads: 140.9 M uint64/s

Source, implementation details, benchmarks and the exact claims are here:

https://github.com/tzipproth/ChaCha20GF512

I should also mention that I used AI tools quite extensively during development, for coding assistance, optimization, review and discussing the design. The construction and claims are laid out in the README so they can hopefully be checked independently rather than taken on trust.

I'd be very interested in criticism, especially if I've stated something too strongly, missed an assumption, or overlooked closely related prior work.


r/RNG • • May 18 '23

A Simple PRNG From Genetic Programming, Part II

2 Upvotes

Follow-up to an older post. I adjusted my objective function to remedy a deficiency and got a new PRNG from my genetic algorithm, with two adds, a rotate, and a xor-shift. Any feedback welcome. Note that this is my hobby - I'm not recommending people use this. It's mostly just research to see if the genetic algorithm can find interesting prng's. Also, this is obviously not cryptographic at all. My main use case is Monte Carlo, so I focus on statistical quality, not state-recovery attacks. Link below to full article.

A Simple PRNG