# Binary Code Generator

## Binary Code Generator

This binary code generator gives a random sequence of binary numbers. Simply put, a list of 1’s and 0’s. Binary numbers are used by computers and communication systems to transfer information. This sequence of binary numbers can be converted to random text by using a ASCII table or converter. This binary code generator is quick and easy to use!

### What is binary code?

Binary code is a sequence, or list, of ones (1’s) and zeros (0’s). In the binary system, only these two elements are used to describe all possible numbers. In the most common numeric system, the decimal systems, we use numbers ranging from 0 to 9, ten different numbers, which is the reason for the name “decimal system”, decimal meaning “based on the number 10”.

### Why is binary code used?

Binary numbers are extremely important since they found the basis of all digital communication and processing. They are used when storing all digital information, such as photos, videos and games stored on a hard drive or a USB stick. All modern computers are digital and operate digital information. The opposite to a digital system is an analog. In analog systems, numbers can take any type of continuous value, however this is not a good approach in computers, since it would be very complex to have several different levels of voltage to store information. In all of today’s systems, a high voltage (‘1’) and low or zero voltage (‘0’) is used instead. This creates a clear boundary and avoids any errors. To be able to understand how computers work, knowledge of binary numbers is necessary.

All numbers can be represented by a binary number, even decimal numbers. The number of decimals will affect the length of the binary number. This puts a direct limitation on computers, we cannot store an “exact” decimal number with an unlimited number of decimal values. Such a number would require an infinite amount of computer memory. Since we cannot store an infinitely long number, or a number with an infinite amount of decimal points, this will lead to some inaccuracies in for example programming and calculations. In general this is fine, and the small round off error created can be lived with since it is usually pretty small.

### Why is it important to understand binary code?

In many areas within computer science and engineering, it is required to have an understanding of how to convert between decimal numbers and binary code. Binary code is in general seen in “low level” areas that are close to the computer hardware, rather than high-level such as high abstraction programming languages such as Python or C++. Binary numbers are seen a lot within embedded systems, specifically in C-programming, Assembly-programming, Memory management and data sheets for embedded systems. To effectively understand these areas, it is very critical to have a basic understanding of binary numbers.

### Binary Code Basics

Let’s start with some useful concepts. A “bit” is simply one number, either a ‘1’ or a ‘0’. This is the lowest level of information carrier in a binary system.  A “byte” is defined as a sequence of 8 bits. Bytes are common for measuring the capacity of memory, for example hard drives are often specified by how many Gigabyte (Gb or Gbyte) of memory they have. The value of a single bit depends on it position, starting from the right, the values are {1, 2, 4, 8, 16, 32, 64 ..}. All these values are the number 2, to the power of the position. ( 2^x, where x is the position starting from the left). We start with a few examples

[1 0 1]  = 4 + 0 + 1 = 5

[1 1 1]  = 4 + 2 + 1 = 7

[1 0 0] = 4 + 0 + 0 = 4

Do you see the pattern? Each position corresponds to a value, and a “1” will add this value to the sum. It might not be clear, but it is actually possible to create any number with this system. Another important thing to note is that we can always add zeroes on the left side without changing the final value, an example is

[0 0 0 0 1] = [0 0 0 1] = [0 0 1] = [0 1] = [1]

This is because we are only adding zeroes, on the left side, which does not add anything to the sum.

## Logic gates and binary code

Within processors and computers, logic gates are used. By only using these, it is actually possible to construct processors (CPUs). These gates can be made by using electronic components called “transistors”, which are incredibly small in size. The latest consumer-level Intel processor has around 1.7 billion transistors, and all this fits in a very small space around the size of a coin.

So let’s continue, what do the logic gates do? The four basic gates are:

If we assume that we input two binary numbers to a gate, the output will be described by

### OR Gate

Performs a check if any of the binary numbers is equal to “1”, if so, the output is “1”, otherwise it is “0”.

### AND Gate

If and only if both of the input binary numbers are equal “1”, the output will be “1”, otherwise it is “0”.

### NOR Gate

Like a OR gate, but the output is reversed.

### XOR Gate

If the two inputs have different value (“1” and “0”, or “0” and “1”), then the output will be one. Otherwise it will always be zero. It can be seen as a “comparator” which gives “1” if the inputs are different.

## Logic Gate Types Summary

These are the four basic gates, by using these, it is possible to construct a wide array of digital elements such as computer memories (Flash memory, RAM, SSD), processors and many other things.