# Can computer viruses form randomly from computer code?

**URL:** <https://boards.straightdope.com/t/can-computer-viruses-form-randomly-from-computer-code/816930>\
**Category:** Factual Questions\
**Created:** [June 28, 2018, 5:03pm UTC](https://boards.straightdope.com/t/can-computer-viruses-form-randomly-from-computer-code/816930 "2018-06-28T17:03:01Z")\
**Posts on this page:** 6\
**Page:** 2

<div class="post-metadata">

**Author:** ![TSBG](https://avatars.discourse-cdn.com/v4/letter/t/77aa72/32.png) [@TSBG](https://boards.straightdope.com/u/TSBG)\
**Post date:** [June 28, 2018, 11:36pm UTC](https://boards.straightdope.com/t/can-computer-viruses-form-randomly-from-computer-code/816930/21 "2018-06-28T23:36:53Z")

</div>

> [@DPRK](#):
>
> No. Artificial neural networks are networks of artificial neurons, and have no “code” to modify. Neural networks are therefore less relevant to the subject of computer viruses than the traditional model of machine code executing on a von Neumann architecture.
> 
> In real life, viruses evolve as a result of biological mechanisms like selection pressure, mutation, recombination, etc. None of these apply to a computer operating system. A buggy computer program will often just crash, and the operating system is supposed to prevent it from being able to corrupt its own code or that of other programs. A piece of code that replicates itself by bypassing system permissions in order to infect other programs can only be the result of clever programming, not random bugs.

Thanks. So neural networks are hardware, not software?

---

<div class="post-metadata">

**Author:** ![DPRK](https://avatars.discourse-cdn.com/v4/letter/d/4491bb/32.png) [@DPRK](https://boards.straightdope.com/u/DPRK)\
**Post date:** [June 28, 2018, 11:45pm UTC](https://boards.straightdope.com/t/can-computer-viruses-form-randomly-from-computer-code/816930/22 "2018-06-28T23:45:01Z")

</div>

> [@TSBG](#):
>
> Thanks. So neural networks are hardware, not software?

They are _virtual_ hardware. Think of it as a software simulation of a wetware system, a simplified model of its biological counterpart, instead of using neurons made of meat.

---

<div class="post-metadata">

**Author:** ![RaftPeople](https://avatars.discourse-cdn.com/v4/letter/r/6f9a4e/32.png) [@RaftPeople](https://boards.straightdope.com/u/RaftPeople)\
**Post date:** [June 29, 2018, 12:32am UTC](https://boards.straightdope.com/t/can-computer-viruses-form-randomly-from-computer-code/816930/23 "2018-06-29T00:32:45Z")

</div>

> [@TSBG](#):
>
> Thanks. So neural networks are hardware, not software?

Think of them as mathematical mapping tables, you can do them with pencil and paper if you want (it’s just function approximation, meaning the mapping between the input we are interested in and the output or answer is a real life function, and the neural network can be trained/adjusted to closely approximate that real life function).

The network takes input numbers, combines them in various ways using various weighting factors and calcs and produces a set of output numbers. Initially it’s kind of random, but then you supply numbers as input where you know what the output should be and then adjust the internal weights/calcs until it gets the right answer. Lather, rinse, repeat. Then, after it’s been trained, when you supply it new numbers that you never trained it on, it will perform the same calcs with the same weights that were trained and arrive at a pretty good answer because the internal calcs are modeling the function you trained it on.

For example, let’s pretend you wanted to create a system that attempts to determine if you are hungry. There is probably a function that maps from a couple input points to a result:  
Input:  
1 - How long since last meal (in hours)  
2 - Size of last meal (scale of 1 to 10)

Output:  
Hungry or not on scale of 1 to 10

A neural network would take the input values (just numbers), combine the numbers in different ways using different weights (e.g. time since last meal \* .5 plus Last meal size \* .2) and spit out a number between 1 and 10. If the number is wrong (e.g. I rate my hunger as a 9 when last meal was \> 8 hours ago, but system said 3, so we need to bump up the “.5” weight that we used to something like “.75” and try again).

After it’s been trained, if you provide input that you didn’t train it on (e.g. 3 hours since last meal and size of last meal was an 8), the system will perform basically proportional calcs and find an answer close to one that it was trained on, answer might be 4 even though closest training was a 3 or a 5.

---

<div class="post-metadata">

**Author:** ![RaftPeople](https://avatars.discourse-cdn.com/v4/letter/r/6f9a4e/32.png) [@RaftPeople](https://boards.straightdope.com/u/RaftPeople)\
**Post date:** [June 29, 2018, 12:47am UTC](https://boards.straightdope.com/t/can-computer-viruses-form-randomly-from-computer-code/816930/24 "2018-06-29T00:47:40Z")

</div>

> [@Czarcasm](#):
>
> Inspired by [this thread.](https://boards.straightdope.com/sdmb/showthread.php?t=857660)😃  
> I’m not talking about a poorly written program that does what the writer didn’t intend it to do, but bits of random coding interacting to form computer virus.

For random bits of coding to interact in a unique and interesting way requires one of two things:  
1 - It’s not doing what the programmer wanted (but you ruled this one out)  
2 - It is doing what the programmer wanted, meaning something like genetic programming or other auto-generated/transformed methods - but that is intentional, not really just random bits interacting

Because you ruled out bugs you also ruled out the most likely mechanism to accomplish what you describe. If you allow for bugs then that’s a whole different story.

---

<div class="post-metadata">

**Author:** ![Isilder](https://avatars.discourse-cdn.com/v4/letter/i/cc9497/32.png) [@Isilder](https://boards.straightdope.com/u/Isilder)\
**Post date:** [June 29, 2018, 12:52am UTC](https://boards.straightdope.com/t/can-computer-viruses-form-randomly-from-computer-code/816930/25 "2018-06-29T00:52:49Z")

</div>

> [@Czarcasm](#):
>
> Inspired by [this thread.](https://boards.straightdope.com/sdmb/showthread.php?t=857660)😃  
> I’m not talking about a poorly written program that does what the writer didn’t intend it to do, but bits of random coding interacting to form computer virus.  
> I don’t know much about programming, so if this is a stupid question, let me know.

There is no such thing as impossible , its just exceptionally improbable. 1 in a googol^ googol ^googol improbable.

The comparison to DNA/RNA … well the atoms , and then molecules, line up electrically like magnets line up NS NS NS NS NS .

There’s no such underlying reason for order to be promoted over randomness in the random creation of computer software …  
What there is a chance of , is an unintentional escape. Antivirus signature files are passed around, right ? Well if the signature file has complete virus entered , which might happen if the antivirus signature people made a mistake and set the “signature” as being the complete virus, eg added a single digit… They meant to put bytes “1 to 10000”, but put “1 to 100000”, by making it 10 times larger, they put a complete virus into the signature file … now all that has to happen is that a corruption of a computer of the target cpu and OS, that has some fault perhaps in the anvirus software, perhaps in hardware, that caused it to act a bit random … which can be either that

- the data was put into memory allocated to the program being run,

- or that the program being run got a jump/branch/subroutine call , and for some reason, eg mathematical overflow, bad bit of hardware… , and the jump was to the virus at a spot which was a good start point to run the virus…

But it takes two faults. The virus people call them SIGNATURE files because they only need some few bytes to be sure they identified the virus. Whats happenned in the past is that they have accidently caused FALSE DETECTION of the virus by using a signature that was detecting program code that has stolen out of a legitimate program.

---

<div class="post-metadata">

**Author:** ![Czarcasm](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/czarcasm/32/4050_2.png) [@Czarcasm](https://boards.straightdope.com/u/Czarcasm)\
**Post date:** [June 29, 2018, 2:24pm UTC](https://boards.straightdope.com/t/can-computer-viruses-form-randomly-from-computer-code/816930/26 "2018-06-29T14:24:33Z")

</div>

I now know more then I did before-Thank you.

[Previous page](https://boards.straightdope.com/t/can-computer-viruses-form-randomly-from-computer-code/816930.md?page=1)
