Skip to main content
Commonmark migration
Source Link

R, 30 22 bytes

###code cat(runif(1)<1/scan()) #new f=function(N)cat(runif(1)<1/N) #old

code

cat(runif(1)<1/scan())          #new
f=function(N)cat(runif(1)<1/N)  #old

It generates a number from a uniform distribution (0 to 1) and should evaluate to true 1/n of the times.

R, 30 22 bytes

###code cat(runif(1)<1/scan()) #new f=function(N)cat(runif(1)<1/N) #old

It generates a number from a uniform distribution (0 to 1) and should evaluate to true 1/n of the times.

R, 30 22 bytes

code

cat(runif(1)<1/scan())          #new
f=function(N)cat(runif(1)<1/N)  #old

It generates a number from a uniform distribution (0 to 1) and should evaluate to true 1/n of the times.

added 64 characters in body
Source Link
Mutador
  • 1.4k
  • 10
  • 15

R, 2830 22 bytes

###code cat(runif(1)<1/scan()) #new f=function(N)cat(runif(1)<1/N) #old

function(N)cat(runif(1)<1/N)

It generates a number from a uniform distribution (0 to 1) and should evaluate to true 1/n of the times.

R, 28

###code

function(N)cat(runif(1)<1/N)

It generates a number from a uniform distribution (0 to 1) and should evaluate to true 1/n of the times.

R, 30 22 bytes

###code cat(runif(1)<1/scan()) #new f=function(N)cat(runif(1)<1/N) #old

It generates a number from a uniform distribution (0 to 1) and should evaluate to true 1/n of the times.

Removed name
Source Link
Adám
  • 31.1k
  • 3
  • 124
  • 287

R, 3028

###code

f=functionfunction(N)cat(runif(1)<1/N)

It generates a number from a uniform distribution (0 to 1) and should evaluate to true 1/n of the times.

R, 30

###code

f=function(N)cat(runif(1)<1/N)

It generates a number from a uniform distribution (0 to 1) and should evaluate to true 1/n of the times.

R, 28

###code

function(N)cat(runif(1)<1/N)

It generates a number from a uniform distribution (0 to 1) and should evaluate to true 1/n of the times.

deleted 123 characters in body
Source Link
Mutador
  • 1.4k
  • 10
  • 15
Loading
added 36 characters in body
Source Link
Mutador
  • 1.4k
  • 10
  • 15
Loading
added 36 characters in body
Source Link
Mutador
  • 1.4k
  • 10
  • 15
Loading
Source Link
Mutador
  • 1.4k
  • 10
  • 15
Loading