Skip to main content
Bounty Awarded with 50 reputation awarded by alephalpha
Golfed 2 bytes
Source Link
DLosc
  • 40.7k
  • 6
  • 87
  • 142

Pari/GP, 4543 bytes

setrand(getwalltime) while(random%9random,print(1)) 

(Don't) Try it online! This version is very likely to time out on TIO; here's a slightly longer version that produces nicer results: Try it online!

Explanation

setrand(getwalltime) 

Seed the random number generator with getwalltime, which is "time in ms since UNIX Epoch."

while(random%9random,print(1)) 

While a large random integer, mod 9, in the range \$[0,2^{31})\$ is not equal to zero, print 1 with a trailing newline.

Pari/GP, 45 bytes

setrand(getwalltime) while(random%9,print(1)) 

Try it online!

Explanation

setrand(getwalltime) 

Seed the random number generator with getwalltime, which is "time in ms since UNIX Epoch."

while(random%9,print(1)) 

While a large random integer, mod 9, is not equal to zero, print 1 with a trailing newline.

Pari/GP, 43 bytes

setrand(getwalltime) while(random,print(1)) 

(Don't) Try it online! This version is very likely to time out on TIO; here's a slightly longer version that produces nicer results: Try it online!

Explanation

setrand(getwalltime) 

Seed the random number generator with getwalltime, which is "time in ms since UNIX Epoch."

while(random,print(1)) 

While a random integer in the range \$[0,2^{31})\$ is not equal to zero, print 1 with a trailing newline.

Source Link
DLosc
  • 40.7k
  • 6
  • 87
  • 142

Pari/GP, 45 bytes

setrand(getwalltime) while(random%9,print(1)) 

Try it online!

Explanation

setrand(getwalltime) 

Seed the random number generator with getwalltime, which is "time in ms since UNIX Epoch."

while(random%9,print(1)) 

While a large random integer, mod 9, is not equal to zero, print 1 with a trailing newline.