6 added 323 characters in body
source | link

R, 67 63 62 6259 bytes

matrix((c(sample(rep(1:0,c(n<-scan(),8-n))),n),6,5)[c(1[2:4,91:5)],3)3]

Try it online!Try it online!

Uses 1 and 0. Build a n* 1 +(8-n)* 0 vector, shuffles it, appends n, rearrangesbuilds the bigger matrix shown below(where a...i stand for displaythe elements of the original vector) and displays on 3 columns.

extracts the proper sub-1 byte thanks to Gregor.matrix shown in uppercase:

     [,1] [,2] [,3] [,4] [,5]
[1,] "a"  "g"  "d"  "a"  "g" 
[2,] "B"  "H"  "E"  "b"  "h" 
[3,] "C"  "I"  "F"  "c"  "i" 
[4,] "D"  "A"  "G"  "d"  "a" 
[5,] "e"  "b"  "h"  "e"  "b" 
[6,] "f"  "c"  "i"  "f"  "c"

R, 67 63 62 bytes

matrix((c(sample(rep(1:0,c(n<-scan(),8-n))),n))[c(1:4,9:5)],3)

Try it online!

Uses 1 and 0. Build a n* 1 +(8-n)* 0 vector, shuffles it, appends n, rearranges for display and displays on 3 columns.

-1 byte thanks to Gregor.

R, 67 63 62 59 bytes

matrix(c(sample(rep(1:0,c(n<-scan(),8-n))),n),6,5)[2:4,1:3]

Try it online!

Uses 1 and 0. Build a n* 1 +(8-n)* 0 vector, shuffles it, appends n, builds the bigger matrix shown below(where a...i stand for the elements of the original vector) and extracts the proper sub-matrix shown in uppercase:

     [,1] [,2] [,3] [,4] [,5]
[1,] "a"  "g"  "d"  "a"  "g" 
[2,] "B"  "H"  "E"  "b"  "h" 
[3,] "C"  "I"  "F"  "c"  "i" 
[4,] "D"  "A"  "G"  "d"  "a" 
[5,] "e"  "b"  "h"  "e"  "b" 
[6,] "f"  "c"  "i"  "f"  "c"
5 added 33 characters in body
source | link

R, 67 63 6362 bytes

writematrix((c(sample(rep(1:0,c(n<-scan(),8-n))),n))[c(1:4,9:5)],1,3)

Try it online!Try it online!

Uses 1 and 0. Build a n* 1 +(8-n)* 0 vector, shuffles it, appends n, rearranges for display and printsdisplays on 3 columns.

-1 byte thanks to Gregor.

R, 67 63 bytes

write((c(sample(rep(1:0,c(n<-scan(),8-n))),n))[c(1:4,9:5)],1,3)

Try it online!

Uses 1 and 0. Build a n* 1 +(8-n)* 0 vector, shuffles it, appends n, rearranges for display and prints on 3 columns.

R, 67 63 62 bytes

matrix((c(sample(rep(1:0,c(n<-scan(),8-n))),n))[c(1:4,9:5)],3)

Try it online!

Uses 1 and 0. Build a n* 1 +(8-n)* 0 vector, shuffles it, appends n, rearranges for display and displays on 3 columns.

-1 byte thanks to Gregor.

4 -4 bytes
source | link

R, 6767 63 bytes

x=rep(0,8);x[sample(1:8,n<-scanwrite())]=1;write(c(x[1:4],n,x[5:8]),1,3)

Try it online!

alternate approach:

R, 67 bytes

x=csample(rep(1:0,8),c(n<-scan());x[sample(1:,8-n))),n)]=1;write(x[c)[c(1:4,9:5)],1,3)

Try it online!Try it online!

Uses 1 and 0. Build a n* 1 +(8-n)* 0 vector, shuffles it, appends n, rearranges for display and prints on 3 columns.

R, 67 bytes

x=rep(0,8);x[sample(1:8,n<-scan())]=1;write(c(x[1:4],n,x[5:8]),1,3)

Try it online!

alternate approach:

R, 67 bytes

x=c(rep(0,8),n<-scan());x[sample(1:8,n)]=1;write(x[c(1:4,9:5)],1,3)

Try it online!

R, 67 63 bytes

write((c(sample(rep(1:0,c(n<-scan(),8-n))),n))[c(1:4,9:5)],1,3)

Try it online!

Uses 1 and 0. Build a n* 1 +(8-n)* 0 vector, shuffles it, appends n, rearranges for display and prints on 3 columns.

3 added 380 characters in body
source | link
2 deleted 13 characters in body
source | link
1
source | link