Random Octal Generator
Generate cryptographically secure random octal (base-8) numbers with configurable length, count, prefix, and separator. Copy or download results instantly.
About
Octal (base-8) representation uses digits 0 - 7 and remains critical in UNIX file permission masks (0755, 0644), legacy PDP-11 instruction encoding, and certain embedded protocols where 3-bit grouping of binary data is more natural than hexadecimal's 4-bit grouping. Generating test fixtures by hand introduces bias: humans disproportionately favour digits 1 - 5 and avoid repeating sequences, which corrupts statistical assumptions in fuzz testing and Monte Carlo simulations. This tool draws each octal digit independently from a uniform distribution over the set {0, 1, โฆ, 7} via the browser's crypto.getRandomValues CSPRNG, ensuring no modulo bias. It approximates true randomness within the limits of the operating system's entropy pool.
Formulas
Each octal digit d is sampled independently from a discrete uniform distribution:
The probability of any specific digit is:
For a number with n digits, the total number of equally probable outcomes is:
To eliminate modulo bias, a random byte r โ [0, 255] from crypto.getRandomValues is masked to 3 bits:
Since 8 divides 256 evenly (256 รท 8 = 32), the bitwise AND produces a perfectly uniform distribution with zero bias. Where d = resulting octal digit, k = any value in {0โฆ7}, n = configured digit length, r = raw random byte, and 0x07 = bitmask (00000111 in binary).
Reference Data
| Decimal | Octal | Binary (3-bit) | Use Case / Note |
|---|---|---|---|
| 0 | 0 | 000 | Null / no permission |
| 1 | 1 | 001 | Execute-only (UNIX) |
| 2 | 2 | 010 | Write-only (UNIX) |
| 3 | 3 | 011 | Write + Execute |
| 4 | 4 | 100 | Read-only (UNIX) |
| 5 | 5 | 101 | Read + Execute |
| 6 | 6 | 110 | Read + Write |
| 7 | 7 | 111 | Read + Write + Execute (full) |
| 8 | 10 | 001 000 | First two-digit octal |
| 64 | 100 | 001 000 000 | First three-digit octal |
| 255 | 377 | 011 111 111 | Max unsigned 8-bit byte |
| 420 | 0644 | - | Typical file permission (rw-r--r--) |
| 493 | 0755 | - | Typical directory permission (rwxr-xr-x) |
| 511 | 0777 | - | Full permission (rwxrwxrwx) - security risk |
| 512 | 1000 | - | First four-digit octal |
| 4095 | 7777 | - | Max 12-bit value (PDP-8 word) |
| 4096 | 10000 | - | 212 - page size on many architectures |
| 65535 | 177777 | - | Max unsigned 16-bit value |
| 16777215 | 77777777 | - | Max 24-bit RGB colour value |
| 2147483647 | 17777777777 | - | Max signed 32-bit integer |