# Random Byte Generator

**URL:** <https://lookmumnocomputer.discourse.group/t/random-byte-generator/1601>\
**Category:** DIY STUFF\
**Created:** [August 12, 2020, 3:30pm UTC](https://lookmumnocomputer.discourse.group/t/random-byte-generator/1601 "2020-08-12T15:30:17Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![telec16](https://yyz2.discourse-cdn.com/free1/user_avatar/lookmumnocomputer.discourse.group/telec16/32/4510_2.png) [@telec16](https://lookmumnocomputer.discourse.group/u/telec16)\
**Post date:** [August 12, 2020, 3:30pm UTC](https://lookmumnocomputer.discourse.group/t/random-byte-generator/1601/1 "2020-08-12T15:30:17Z")

</div>

Currently (and for the next few weeks), I don’t have access to my gears… So to occupy myself a bit I try to design new modules.  
For one of them, I need a random source of bits, and I found this circuit (upper part):

 ![image](https://global.discourse-cdn.com/free1/uploads/lookmumnocomputer/original/2X/f/ffc31922a2f0d706dfb4f6be4218ef157faab6c9.png)

Did any of you ever tried this one (or has a better alternative)? It’s quite difficult to simulate randomness…  
Also, what are your thoughts on the oscillator circuit? I tried to simulate it too, but no success. I don’t know if it’s from the circuit itself or because the simulator just can’t…

---

<div class="post-metadata">

**Author:** ![Caustic](https://yyz2.discourse-cdn.com/free1/user_avatar/lookmumnocomputer.discourse.group/caustic/32/15588_2.png) [@Caustic](https://lookmumnocomputer.discourse.group/u/Caustic)\
**Post date:** [August 12, 2020, 4:02pm UTC](https://lookmumnocomputer.discourse.group/t/random-byte-generator/1601/2 "2020-08-12T16:02:53Z")

</div>

My first thought is to use a noise generator and sample from it, then run through a ADC. How complex did your pseudo-randomness need to be?

You can go about this by algorithm or with physical processes.

Knowing more why you need this might help in recommending a method.

---

<div class="post-metadata">

**Author:** ![Caustic](https://yyz2.discourse-cdn.com/free1/user_avatar/lookmumnocomputer.discourse.group/caustic/32/15588_2.png) [@Caustic](https://lookmumnocomputer.discourse.group/u/Caustic)\
**Post date:** [August 12, 2020, 4:11pm UTC](https://lookmumnocomputer.discourse.group/t/random-byte-generator/1601/3 "2020-08-12T16:11:45Z")

</div>

![image](https://global.discourse-cdn.com/free1/uploads/lookmumnocomputer/original/2X/0/09997c946ff5d1e917bc1a94aebebfb4c8fc30e2.png)  
 ![image](https://global.discourse-cdn.com/free1/uploads/lookmumnocomputer/original/2X/3/3670298e5fa84f39b12d8b6421b1b0f3201f41c8.png)

> **[Simple White Noise Generator Circuit](https://circuitdigest.com/electronic-circuits/simple-white-noise-generator-circuit-diagram)**
>
> Every single circuit designer uses different techniques to remove noises from their circuit design. Noise is one of the main issues while building any circuit specially related to Audio or Power Electronics, but today, we will make a circuit which...

Just one example, but it should be simple to generate noise since a lot of times it happens when we dont want it.

Importantly though, you want white noise since for better random numbers you dont want a bias.

I dont think the transistor type is too important here, so use what you got i think:

 ![image](https://global.discourse-cdn.com/free1/uploads/lookmumnocomputer/original/2X/2/2e859d05f2f0eabeac2551080add0e0d0497b3fd.png)

At least when you run this through your ADC you dont have to wrry much about aliasing or signal to noise ratio!

Whats the bit depth you are after? (thread said a byte, but im just checking)

---

<div class="post-metadata">

**Author:** ![telec16](https://yyz2.discourse-cdn.com/free1/user_avatar/lookmumnocomputer.discourse.group/telec16/32/4510_2.png) [@telec16](https://lookmumnocomputer.discourse.group/u/telec16)\
**Post date:** [August 12, 2020, 4:24pm UTC](https://lookmumnocomputer.discourse.group/t/random-byte-generator/1601/4 "2020-08-12T16:24:00Z")

</div>

Oh I hadn’t thought about that! But it seems that I would get a biased value, no? (I really don’t know, true random is hard!)

I don’t have much space left, so the circuit should have a small footprint. But yeah actually, just a clocked ADC and no need for the sample and hold, that could fit!

I’m designing a logic gate version of that: [https://r0d0t.tumblr.com/post/45022928402](https://r0d0t.tumblr.com/post/45022928402), a “Random Jazz Machine”, so I need random bits to select the notes and patterns (full schematic (from me) here: [https://github.com/telec16/modular-synth/blob/master/RJG/schematic.pdf](https://github.com/telec16/modular-synth/blob/master/RJG/schematic.pdf)).

---

<div class="post-metadata">

**Author:** ![Caustic](https://yyz2.discourse-cdn.com/free1/user_avatar/lookmumnocomputer.discourse.group/caustic/32/15588_2.png) [@Caustic](https://lookmumnocomputer.discourse.group/u/Caustic)\
**Post date:** [August 12, 2020, 4:26pm UTC](https://lookmumnocomputer.discourse.group/t/random-byte-generator/1601/5 "2020-08-12T16:26:31Z")

</div>

> [@telec16](#):
>
> But it seems that I would get a biased value, no?

Not really, unless you want to go the quantum randomness level (like a Geiger Counter), this will probably suffice.

> [@telec16](#):
>
> I don’t have much space left, so the circuit should have a small footprint.

When you add the clock and adc this shouldnt add much.

This design is a hardware random number generator, it uses stochastic processes that are unpredictable, and generally considered random.

Other ways include using a transducer to convert physical phenomena into an electrical signal (like a sensor), then using an amplifier to raise the amplitude of those fluctuations to a measurable level. You could prolly do this with a moisture sensor or LDR and it would work fine.

The only time i would recommend a software solution is if its easier (already using a microcontroller) or if you need to be able to use seeds (looks like the link you provided does implement seeds, so you wont be able to do that here).

---

<div class="post-metadata">

**Author:** ![telec16](https://yyz2.discourse-cdn.com/free1/user_avatar/lookmumnocomputer.discourse.group/telec16/32/4510_2.png) [@telec16](https://lookmumnocomputer.discourse.group/u/telec16)\
**Post date:** [August 12, 2020, 4:36pm UTC](https://lookmumnocomputer.discourse.group/t/random-byte-generator/1601/6 "2020-08-12T16:36:15Z")

</div>

> [@Caustic](#):
>
> Not really, unless you want to go the quantum randomness level (like a Geiger Counter), this will probably suffice.

But if the noise level is not to scale with the input of the ADC, I will have a noticeable bias, no? I need to check that…

> [@Caustic](#):
>
> When you add the clock and adc this shouldnt add much.

Yep, that’s what I thought will writing.

> [@Caustic](#):
>
> This design

Which one?

> [@Caustic](#):
>
> Other ways include using a transducer to convert physical phenomena into an electrical signal (like a sensor), then using an amplifier to raise the amplitude of those fluctuations to a measurable level. You could prolly do this with a moisture sensor or LDR and it would work fine.

I don’t think this idea could fit my needs, it seems to vary too slowly/to be too easy to bias…

> [@Caustic](#):
>
> The only time i would recommend a software solution is if its easier (already using a microcontroller) or if you need to be able to use seeds.

For sure that would be easier, but I aim at a non-microcontroller solution !

---

<div class="post-metadata">

**Author:** ![Caustic](https://yyz2.discourse-cdn.com/free1/user_avatar/lookmumnocomputer.discourse.group/caustic/32/15588_2.png) [@Caustic](https://lookmumnocomputer.discourse.group/u/Caustic)\
**Post date:** [August 12, 2020, 4:37pm UTC](https://lookmumnocomputer.discourse.group/t/random-byte-generator/1601/7 "2020-08-12T16:37:43Z")

</div>

This is actually funny because this is sorta related to the breakdown voltage discussions with the super simple oscillator.

SEE ALL THE THREADS OF ALL THE ISSUES:

> [@Troubles with the SUPER SIMPLE OSCILLATOR](https://lookmumnocomputer.discourse.group/t/troubles-with-the-super-simple-oscillator/772/10):
>
> A few threads have discussed problems with this Circuit. Not sure if its because its usually people’s first or that really this reverse avalanche effect that causes the oscillation isnt as consistent as people expect. I skipped building this thing, so i cant say i have any experience with this one. Do you have a multimeter? If se, we can guide you in the process of troubleshooting if you like. Also, are you using new batteries?

TLDR; if one transistor doesnt avalanche, try another.

See this for more info:

> **[Random Sequence Generator based on Avalanche Noise](http://holdenc.altervista.org/avalanche/)**
>
> Random Sequence Generator based on Avalanche Noise

---

<div class="post-metadata">

**Author:** ![ChristianBloch](https://yyz2.discourse-cdn.com/free1/user_avatar/lookmumnocomputer.discourse.group/christianbloch/32/56_2.png) [@ChristianBloch](https://lookmumnocomputer.discourse.group/u/ChristianBloch)\
**Post date:** [August 12, 2020, 4:52pm UTC](https://lookmumnocomputer.discourse.group/t/random-byte-generator/1601/8 "2020-08-12T16:52:05Z")

</div>

Or, you could go the @nervous_squirrel route:

[![](https://global.discourse-cdn.com/free1/uploads/lookmumnocomputer/original/2X/f/fcbaf66b9110706859ea85e847c83ffda48839d5.jpeg "Geiger counter synth module with uranium ore") ](https://www.youtube.com/watch?v=Fj1PhEqVBq4)

 ![image](https://global.discourse-cdn.com/free1/uploads/lookmumnocomputer/original/2X/5/548c535d3a91c1e923bb07533ddc2c3d7e940c4b.jpeg)

🤣

---

<div class="post-metadata">

**Author:** ![telec16](https://yyz2.discourse-cdn.com/free1/user_avatar/lookmumnocomputer.discourse.group/telec16/32/4510_2.png) [@telec16](https://lookmumnocomputer.discourse.group/u/telec16)\
**Post date:** [August 12, 2020, 4:56pm UTC](https://lookmumnocomputer.discourse.group/t/random-byte-generator/1601/9 "2020-08-12T16:56:11Z")

</div>

Ahah! Yep that would be true random! With a slightly bigger footprint though 😛

---

<div class="post-metadata">

**Author:** ![analogoutput](https://yyz2.discourse-cdn.com/free1/user_avatar/lookmumnocomputer.discourse.group/analogoutput/32/29663_2.png) [@analogoutput](https://lookmumnocomputer.discourse.group/u/analogoutput)\
**Post date:** [August 12, 2020, 5:02pm UTC](https://lookmumnocomputer.discourse.group/t/random-byte-generator/1601/10 "2020-08-12T17:02:38Z")

</div>

For a smaller footprint use plutonium

---

<div class="post-metadata">

**Author:** ![Bitnik](https://yyz2.discourse-cdn.com/free1/user_avatar/lookmumnocomputer.discourse.group/bitnik/32/274_2.png) [@Bitnik](https://lookmumnocomputer.discourse.group/u/Bitnik)\
**Post date:** [August 12, 2020, 5:19pm UTC](https://lookmumnocomputer.discourse.group/t/random-byte-generator/1601/11 "2020-08-12T17:19:20Z")

</div>

You could use the innards of a smoke detector to give you some radioactive decay. I’m not mad enough to want to do that though. I’d look for a decent PRNG implemented on AVR (the 8-bit chip they use for Arduino.) It should be easily good enough for synth. The well named ATtiny85 chip has 8 legs and can run on a low voltage source and will spit out randomish numbers until the crack of doom.

---

<div class="post-metadata">

**Author:** ![Maxhirez](https://yyz2.discourse-cdn.com/free1/user_avatar/lookmumnocomputer.discourse.group/maxhirez/32/42_2.png) [@Maxhirez](https://lookmumnocomputer.discourse.group/u/Maxhirez)\
**Post date:** [August 12, 2020, 5:24pm UTC](https://lookmumnocomputer.discourse.group/t/random-byte-generator/1601/12 "2020-08-12T17:24:05Z")

</div>

What could go wrong?

---

<div class="post-metadata">

**Author:** ![telec16](https://yyz2.discourse-cdn.com/free1/user_avatar/lookmumnocomputer.discourse.group/telec16/32/4510_2.png) [@telec16](https://lookmumnocomputer.discourse.group/u/telec16)\
**Post date:** [August 12, 2020, 5:28pm UTC](https://lookmumnocomputer.discourse.group/t/random-byte-generator/1601/13 "2020-08-12T17:28:27Z")

</div>

Ah yes, for sure it would be simpler to use a microcontroller, but where is the fun in that? (“my favorite programming language is solder!”)

---

<div class="post-metadata">

**Author:** ![telec16](https://yyz2.discourse-cdn.com/free1/user_avatar/lookmumnocomputer.discourse.group/telec16/32/4510_2.png) [@telec16](https://lookmumnocomputer.discourse.group/u/telec16)\
**Post date:** [August 12, 2020, 5:30pm UTC](https://lookmumnocomputer.discourse.group/t/random-byte-generator/1601/14 "2020-08-12T17:30:14Z")

</div>

That would be better, even, as the radioactive waves would randomly trigger the logic gates of the circuit!

---

<div class="post-metadata">

**Author:** ![nervous\_squirrel](https://yyz2.discourse-cdn.com/free1/user_avatar/lookmumnocomputer.discourse.group/nervous_squirrel/32/2871_2.png) [@nervous\_squirrel](https://lookmumnocomputer.discourse.group/u/nervous_squirrel)\
**Post date:** [August 12, 2020, 6:23pm UTC](https://lookmumnocomputer.discourse.group/t/random-byte-generator/1601/15 "2020-08-12T18:23:02Z")

</div>

After making this module I found out that David Cockerell and Peter Zinovieff had pretty much done the same thing sometime around 1965. They were generating random voltages for musical purposes using a geiger counter and a glowing radioactive wristwatch!

---

<div class="post-metadata">

**Author:** ![ChristianBloch](https://yyz2.discourse-cdn.com/free1/user_avatar/lookmumnocomputer.discourse.group/christianbloch/32/56_2.png) [@ChristianBloch](https://lookmumnocomputer.discourse.group/u/ChristianBloch)\
**Post date:** [August 12, 2020, 8:07pm UTC](https://lookmumnocomputer.discourse.group/t/random-byte-generator/1601/16 "2020-08-12T20:07:02Z")

</div>

Yeah, heard the story on your episode of Esoteric Modulation. Great one, BTW!

---

<div class="post-metadata">

**Author:** ![Caustic](https://yyz2.discourse-cdn.com/free1/user_avatar/lookmumnocomputer.discourse.group/caustic/32/15588_2.png) [@Caustic](https://lookmumnocomputer.discourse.group/u/Caustic)\
**Post date:** [August 12, 2020, 8:48pm UTC](https://lookmumnocomputer.discourse.group/t/random-byte-generator/1601/17 "2020-08-12T20:48:58Z")

</div>

Just use a laser and a LDR with traffic in-between.

---

<div class="post-metadata">

**Author:** ![nervous\_squirrel](https://yyz2.discourse-cdn.com/free1/user_avatar/lookmumnocomputer.discourse.group/nervous_squirrel/32/2871_2.png) [@nervous\_squirrel](https://lookmumnocomputer.discourse.group/u/nervous_squirrel)\
**Post date:** [August 12, 2020, 9:11pm UTC](https://lookmumnocomputer.discourse.group/t/random-byte-generator/1601/18 "2020-08-12T21:11:46Z")

</div>

That’s great that you heard that - fantastic!

---

<div class="post-metadata">

**Author:** ![devicex](https://yyz2.discourse-cdn.com/free1/user_avatar/lookmumnocomputer.discourse.group/devicex/32/28_2.png) [@devicex](https://lookmumnocomputer.discourse.group/u/devicex)\
**Post date:** [August 12, 2020, 9:14pm UTC](https://lookmumnocomputer.discourse.group/t/random-byte-generator/1601/19 "2020-08-12T21:14:40Z")

</div>

this is getting pretty hard core ! radiation , laser beams and playing with traffic . wait till we start jumping out of planes and dancing on the rims of volcanoes .

---

<div class="post-metadata">

**Author:** ![Maxhirez](https://yyz2.discourse-cdn.com/free1/user_avatar/lookmumnocomputer.discourse.group/maxhirez/32/42_2.png) [@Maxhirez](https://lookmumnocomputer.discourse.group/u/Maxhirez)\
**Post date:** [August 12, 2020, 9:52pm UTC](https://lookmumnocomputer.discourse.group/t/random-byte-generator/1601/20 "2020-08-12T21:52:35Z")

</div>

> [@devicex](#):
>
> wait till we start jumping out of planes and dancing on the rims of volcanoes .

You really want to go giving this crew ideas like that?

[Next page](https://lookmumnocomputer.discourse.group/t/random-byte-generator/1601.md?page=2)
