Skip to main content
Update comments
Source Link
user36046
user36046

x86 32-bit machine code (Linux), 22 bytes

00000000: 31db f7e3 4243 6a31 89e1 0404 cd80 580f 1...BCj1......X. 00000010: c7f0 a801 75ea ....u. 

Asssembly:

section .text 	global main main: 	;call write(fd=ebx, *buf=ecx, count=edx) 	xor ebx, ebx	;ebx=0 	mul ebx		;eax=edx=0 	inc edx		;edx=1 	inc ebx		;ebx=1 	push 0x31	;push '1' 	mov ecx, esp 	;ecx=ptr to '1' 	add al, 4	;eax=4 	int 0x80	;syscall to print '1' 	pop eax		;fix stack 	;get rand & loop 	rdrand eax	;eax=rand() 	test al, 1	;eax%2==0? 	jnz main 	;if so, jmp to main 

There is a 50% probability for each character printed for another one to print.

Try it online!

x86 32-bit machine code (Linux), 22 bytes

00000000: 31db f7e3 4243 6a31 89e1 0404 cd80 580f 1...BCj1......X. 00000010: c7f0 a801 75ea ....u. 

Asssembly:

section .text 	global main main: 	;call write(fd=ebx, *buf=ecx, count=edx) 	xor ebx, ebx	;ebx=0 	mul ebx		;eax=edx=0 	inc edx		;edx=1 	inc ebx		;ebx=1 	push 0x31	;push '1' 	mov ecx, esp 	;ecx=ptr to '1' 	add al, 4	;eax=4 	int 0x80	;syscall 	pop eax		;fix stack 	;get rand & loop 	rdrand eax	;eax=rand() 	test al, 1	;eax%2==0? 	jnz main 	;if so, jmp to main 

There is a 50% probability for each character printed for another one to print.

Try it online!

x86 32-bit machine code (Linux), 22 bytes

00000000: 31db f7e3 4243 6a31 89e1 0404 cd80 580f 1...BCj1......X. 00000010: c7f0 a801 75ea ....u. 

Asssembly:

section .text 	global main main: 	;call write(fd=ebx, *buf=ecx, count=edx) 	xor ebx, ebx	;ebx=0 	mul ebx		;eax=edx=0 	inc edx		;edx=1 	inc ebx		;ebx=1 	push 0x31	;push '1' 	mov ecx, esp 	;ecx=ptr to '1' 	add al, 4	;eax=4 	int 0x80	;syscall to print '1' 	pop eax		;fix stack 	;get rand & loop 	rdrand eax	;eax=rand() 	test al, 1	;eax%2==0? 	jnz main 	;if so, jmp to main 

There is a 50% probability for each character printed for another one to print.

Try it online!

Source Link
user36046
user36046

x86 32-bit machine code (Linux), 22 bytes

00000000: 31db f7e3 4243 6a31 89e1 0404 cd80 580f 1...BCj1......X. 00000010: c7f0 a801 75ea ....u. 

Asssembly:

section .text 	global main main: 	;call write(fd=ebx, *buf=ecx, count=edx) 	xor ebx, ebx	;ebx=0 	mul ebx		;eax=edx=0 	inc edx		;edx=1 	inc ebx		;ebx=1 	push 0x31	;push '1' 	mov ecx, esp 	;ecx=ptr to '1' 	add al, 4	;eax=4 	int 0x80	;syscall 	pop eax		;fix stack 	;get rand & loop 	rdrand eax	;eax=rand() 	test al, 1	;eax%2==0? 	jnz main 	;if so, jmp to main 

There is a 50% probability for each character printed for another one to print.

Try it online!