On Linux / x86 gcc with optimization enabled, your code will be compiled as follows:
rax = arr rdi = BIGNUMBER 400690: c7 04 90 01 00 00 00 movl $0x1,(%rax,%rdx,4)
Move immediate int(1) to rax + rdx
400697: 48 83 c2 01 add $0x1,%rdx
Incremental register rdx
40069b: 48 39 fa cmp %rdi,%rdx
Cmp rdi to rdx
40069e: 75 f0 jne 400690 <main+0xa0>
If BIGNUMBER has been reached, go back to start.
It takes about 1 second per gigabyte on my machine, but most of this I swap in physical memory to return an uninitialized distribution.
source share