Thousands of tools! Check out Online Tools – I have now added thousands of tools.
I often have to generate random bits so I created this simple online utility that does it for me. It lets you generate as many random bits or bit groups as you need. It works in the browser and is powered by alien technology from the future.
Random Bit Generator Options
Random Bit Generator Examples (click to try!)
0 011 1101 0110 1 0 1011 100 00 010 01 0100 0111 00 010 0 1000 1 0100 110 00 0 0 10 0100 001 011 1 11 0 1 11 0011 011 11 001 1000 01 11 1111 11 111 1000 0 0 01 1100 10 1 001 001 1 1001 000 1 0 0001 0011 1 1 11 1101 1 111 1 1 110 11 0011 10 00 00 000 00 1110 0101 11 101 0110 0 00 00 0 110 0001 011 0 111 110 0 00 1000 10 1100 01 111 101 1 111 1000
0b10101110 (174) 0b00010110 (22) 0b00110000 (48) 0b10110100 (180) 0b01110101 (117) 0b01011111 (95) 0b00010111 (23) 0b10100000 (160) 0b00111110 (62) 0b00110110 (54)
1.1.1.0.0.1.0.1₂ (229), 1.1.1.1.1.0.1.1₂ (251), 1.1.0.1.1.1.1.1₂ (223), 1.1.1.1.1.1.1.1₂ (255), 1.1.1.1.1.1.1.1₂ (255), 1.1.1.1.1.1.0.1₂ (253), 1.1.1.1.1.1.1.0₂ (254), 1.1.0.0.0.1.0.0₂ (196), 1.1.1.0.0.1.0.1₂ (229), 1.1.1.1.0.0.0.0₂ (240), 1.1.1.0.1.1.1.0₂ (238), 1.1.1.0.0.0.0.0₂ (224), 1.1.1.1.0.1.0.0₂ (244), 1.1.1.1.1.1.0.1₂ (253), 1.1.0.1.0.1.0.1₂ (213), 1.1.1.1.0.0.1.0₂ (242), 1.1.1.1.1.0.1.1₂ (251), 1.1.1.1.1.1.0.0₂ (252), 1.1.1.1.1.1.1.0₂ (254), 1.1.1.1.1.1.0.0₂ (252)
How Does This Random Bit Generator Work?
This random bit generator works entirely in your browser and is written in JavaScript. To generate random bits, it runs two nested for
loops. The first loop runs count
times. This variable can be set in the options and it determines how many individual bits or bit groups will appear in the output. Generating individual bits is the same as generating bit groups of length one. In every iteration, it creates an empty array groupBits = []
that will store the randomly generated bits. If the group length is one, then single bits will be generated. Otherwise, groups of multiple bits will be generated. The groupLength
variable controls how many bits will appear in a single bit group. This variable takes a comma-separated list of lengths. For example, the value 2, 4, 7-8
will generate bit groups with two, four, or seven, or eight bits. The contents of the groupLength
variable is parsed and stored in the groupLengths
array. In the example with the value 2, 4, 7-8
, the groupLengths
array becomes [2, 4, 7, 8]
. To select a group length from several, the program generates a random array index using the formula Math.floor(Math.random() * groupLengths.length)
and puts the element with this index into the variable curBitLen
. This variable determines how many bits will be randomly generated. At this point, the inner loop is set up and runs curBitLen
times. It generates random bits using the formula bit = Math.floor(Math.random() * 2)
. When a bit is generated, it's push
ed to the groupBits
array. After filling this array with curBitLen
bits, the program converts them into a string by calling the groupBits.join(bitSeparator)
method. Then, it adds the optional padding, prefix, and decimal value to this string, and push
es the formatted group of bits to the bitsOut
array, and repeats the outer loop again. After generating count
bit groups, the program calls bitsOut.join(groupSeparator)
function that creates the final string of all bit groups and it's then displayed on the screen.
Created by Browserling
This random bit generator was created by me and my team at Browserling. Behind the scenes, it's actually powered by our web developer tools that are used by millions of people every month. Browserling itself is an online cross-browser testing service powered by alien technology. Check it out!
Secret message: If you love my tools, then I love you, too! Use coupon code TOOLLING to get a discount at my company.