Answers.Body: <blockquote>
    <p>AI is supposed to do anything human or traditional computer can do, that is what we expect AI to be.</p>
  </blockquote>
  
  <p>Technically you would need A<strong>G</strong>I (Artifical General Intelligence) to do anything a human can do. This is not a technology that exists, but a goal of some AI research to perform more and more general tasks.</p>
  
  <blockquote>
    <p>So 'generating random value' is also a task included in the scope that AI should be able to do</p>
  </blockquote>
  
  <p>Humans are actually very bad at generating random values directly. In fact <a href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3632045/" rel="nofollow noreferrer">it is possible to identify a person</a> by getting them to generate random numbers from their mind. Indirectly, a human could pick up a die, roll it, and read the number - this is also something that is within capabilities of modern AI, but not something you could implement with a small neural network.</p>
  
  <p>Computer <em>software</em> cannot generate random numbers directly, only pseudo-random numbers that are deterministic but follow a statistical pattern very similar to theoretical randomness. When combined with frequently changing seed data from the environment, this becomes very close to an ideal random source, but it does require some hardware input. Modern computer chips include an internal source of randomness to provide this seed data, but it is important to note that it is a piece of specialised hardware, not something that can be coded or simulated using a simple neural network.</p>
  
  <blockquote>
    <p>I'm trying to generate random value using a single neuron but the outcome isn't much good. Any suggestions?</p>
  </blockquote>
  
  <p>This is going to be much harder than you assumed. Random number generators are always more complex than a single function, and require at least a little bit of architecture. The simplest architecture would be to add a state value to use as the next input to the generator, and which is somehow affected by the previous output. A simple feed-forward neural network does not have any architecture like this, you need to add it.</p>
  
  <p>My first suggestion would be to learn how some simple software pseudo-random number generators (PRNGs) work. A good place to start might be <a href="https://en.wikipedia.org/wiki/Linear_congruential_generator" rel="nofollow noreferrer">linear congruential generators</a> which are considered very poor quality PRNGs nowadays, but are the sort found in early computer systems.</p>
  
  <p>It should be possible to create a rough approximation to a PRNG from a single neuron. Picking the weight, bias and non-linear functions carefully should allow you to produce something similar to the linear congruential generator, where it generates the next pseudo-random number when you input the previous one. A slightly more sophisticated approach would be to make this a simple recurrent neural network (RNN) so that the neural network has an internal state - such a network could still have a single neuron.</p>
  
  <p>An example neuron that works like this might have a weight of 3, bias of 1 (to generate a <em>logit</em> from input <span class="math-container">$x$</span> of <span class="math-container">$z= 3x+1$</span>) and have activation function <span class="math-container">$y = 1000\text{sin}(z) \text{ mod } 1$</span>. This is not a normal activation function that you would use to train a neural network - in fact this neural network probably could not be trained at all. It has been specially designed to achieve your goal of generating (pseudo-)random numbers using a single neuron. It is a valid neural network though.</p>
  
  <p>I created the above example neuron, started it with a seed of 0, and got the sequence <code>0.4710, 0.8543, 0.1536, 0.9479, 0.1142, 0.0683, 0.7741, 0.2985, 0.7315, 0.0777, 0.5078</code> by feeding back previous values - you can see it is working, although it is probably a very bad random number generator even compared to linear congruential generators. Possibly better than a human though.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-05-11T07:47:36.120Z
Answers.LastActivityDate: 2020-05-11T08:07:44.017Z
Answers.LastEditDate: 2020-05-11T08:07:44.017Z
Answers.UserDisplayName: Neil Slater
Body: <p>AI is supposed to do anything human or traditional computer can do, that is what we expect AI to be.</p>
  
  <p>So '<strong>generating random value</strong>' is also a task included in the scope that AI should be able to do </p>
  
  <p>I'm trying to generate random value using a single neuron but the outcome isn't much good.
  Any suggestions? </p>
  
  <p>PS.<br/>
  Random weight initialisation is allowed coz weights are constants at start.<br/>
  Using 'random' function is forbidden anywhere else.</p>
  
Tags: <machine-learning><randomness><generator><neural-networks><deep-neural-networks>
Title: Random value generator using a single neuron or DNN
UserDisplayName: Dan D.
ThreadText: # Random value generator using a single neuron or DNN
  
  (Asked by: username_0 on 2020-05-11)
  
  AI is supposed to do anything human or traditional computer can do, that is what we expect AI to be.
  
  So '**generating random value**' is also a task included in the scope that AI should be able to do
  
  I'm trying to generate random value using a single neuron but the outcome isn't much good.
  Any suggestions?
  
  PS.  
  Random weight initialisation is allowed coz weights are constants at start.  
  Using 'random' function is forbidden anywhere else.
  
  **Tags:** machine-learning, randomness, generator, neural-networks, deep-neural-networks
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2020-05-11. Score: 1 | Accepted answer
  
  > AI is supposed to do anything human or traditional computer can do, that is what we expect AI to be.
  
  Technically you would need A**G**I (Artifical General Intelligence) to do anything a human can do. This is not a technology that exists, but a goal of some AI research to perform more and more general tasks.
  
  > So 'generating random value' is also a task included in the scope that AI should be able to do
  
  Humans are actually very bad at generating random values directly. In fact [it is possible to identify a person](https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3632045/) by getting them to generate random numbers from their mind. Indirectly, a human could pick up a die, roll it, and read the number - this is also something that is within capabilities of modern AI, but not something you could implement with a small neural network.
  
  Computer *software* cannot generate random numbers directly, only pseudo-random numbers that are deterministic but follow a statistical pattern very similar to theoretical randomness. When combined with frequently changing seed data from the environment, this becomes very close to an ideal random source, but it does require some hardware input. Modern computer chips include an internal source of randomness to provide this seed data, but it is important to note that it is a piece of specialised hardware, not something that can be coded or simulated using a simple neural network.
  
  > I'm trying to generate random value using a single neuron but the outcome isn't much good. Any suggestions?
  
  This is going to be much harder than you assumed. Random number generators are always more complex than a single function, and require at least a little bit of architecture. The simplest architecture would be to add a state value to use as the next input to the generator, and which is somehow affected by the previous output. A simple feed-forward neural network does not have any architecture like this, you need to add it.
  
  My first suggestion would be to learn how some simple software pseudo-random number generators (PRNGs) work. A good place to start might be [linear congruential generators](https://en.wikipedia.org/wiki/Linear_congruential_generator) which are considered very poor quality PRNGs nowadays, but are the sort found in early computer systems.
  
  It should be possible to create a rough approximation to a PRNG from a single neuron. Picking the weight, bias and non-linear functions carefully should allow you to produce something similar to the linear congruential generator, where it generates the next pseudo-random number when you input the previous one. A slightly more sophisticated approach would be to make this a simple recurrent neural network (RNN) so that the neural network has an internal state - such a network could still have a single neuron.
  
  An example neuron that works like this might have a weight of 3, bias of 1 (to generate a *logit* from input $x$ of $z= 3x+1$) and have activation function $y = 1000\text{sin}(z) \text{ mod } 1$. This is not a normal activation function that you would use to train a neural network - in fact this neural network probably could not be trained at all. It has been specially designed to achieve your goal of generating (pseudo-)random numbers using a single neuron. It is a valid neural network though.
  
  I created the above example neuron, started it with a seed of 0, and got the sequence `0.4710, 0.8543, 0.1536, 0.9479, 0.1142, 0.0683, 0.7741, 0.2985, 0.7315, 0.0777, 0.5078` by feeding back previous values - you can see it is working, although it is probably a very bad random number generator even compared to linear congruential generators. Possibly better than a human though.
  
  
  ---
  
  