[Question]
  [
Your task is simple: write a program that will replace random pixels in a black 16px \* 8px rectangle (width by height) with a white pixel.
The holes must be uniformly random, and you should output the 16px by 8 px image with the white pixels inserted. 
Replace only 1 pixel per column (16 total replaced pixels)
You don't take any input, and you can't rely on the image being stored elsewhere on the computer.
This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'") so the program with the shortest bytecount wins!
  
[Answer]
# [MATL](https://github.com/lmendo/MATL), ~~15~~ ~~14~~ 13 bytes
```
8tE2$r&S1=3YG
```
Example (with MATL compiler running on MATLAB):
[![enter image description here](https://i.stack.imgur.com/dclQB.png)](https://i.stack.imgur.com/dclQB.png)
Or try it at [**MATL Online!**](https://matl.io/?code=8tE2%24r%26S1%3D3YG&inputs=&version=19.7.0) (If it doesn't run the first time, press "Run" again or refresh the page). Note that the image is scaled by the online interpreter for better visualization.
This is a port of my [Octave / MATLAB answer](https://codegolf.stackexchange.com/a/104464/36398) (see explanation there). Here are the equivalent statements:
```
MATL        Octave / MATLAB
----        ---------------
8tE         8,16
2$r         rand(...)
&S          [~,out]=sort(...)
1=          ...==1 
3YG         imshow(...)
```
[Answer]
# Pyth - ~~16~~ 15 bytes
Outputs image to `o.png`.
```
.wCm.S+255mZ7y8
```
Example image:
[![](https://i.stack.imgur.com/ylk3j.png)](https://i.stack.imgur.com/ylk3j.png)
[Answer]
# C, ~~85~~ 100 bytes
```
main(c){char a[138]="P5 16 8 1 ";for(srand(time(0)),c=17;--c;a[9+c+(rand()&112)]=1);write(1,a,138);}
```
Writes a [PGM](http://netpbm.sourceforge.net/doc/pgm.html) image file to stdout (call it with `prog >out.pgm`).
**Ungolfed and explained:**
```
main(c) {
    // A buffer large enough to contain the whole image,
    // pre-filled with the PGM header.
    // This is a binary greyscale (P5) image with only two levels (1),
    // Because a binary bitmap would require pixel packing.
    char a[138] = "P5 16 8 1 ";
    
    // c iterates from 16 to 1 over the columns
    for(
        srand(time(0)), c = 17;
        --c;
        
        // (rand() % 8) * 16 is equivalent to (rand() & 7) << 4
        // Since all bits are equally random, this is equivalent
        // to rand() & (7 << 4), that is rand() & 112.
        // This picks a pixel from the first column, which is then
        // offset to the correct column by c - 1 + 10
        // (10 is the length of the header).
        a[9 + c + (rand() & 112)] = 1
    )
        ; // Empty for body
    
    // Write the whole buffer to stdout
    write(1,a,138);
}
```
**Updates:**
* OP has clarified that the output should change with each execution, lost 15 bytes to `srand(time(0))` (`:(`)
[Answer]
## Ruby, 61 bytes
```
puts'P116 8';puts Array.new(16){[*[1]*7,0].shuffle}.transpose
```
This is a full program that outputs the image in netpbm format to stdout.
Sample output:
[![](https://i.stack.imgur.com/Jg5My.png)](https://i.stack.imgur.com/Jg5My.png)
```
puts'P116 8';   # output the netpbm header (P1 for black and white, 16x8)
puts            # then output the data as follows:
Array.new(16){  # make a 16-element array and for each element,
[*[1]*7,0]      # generate the array [1,1,1,1,1,1,1,0] (1=black 0=white)
.shuffle}       # shuffle the array
.transpose      # transpose the rows/columns of the 2d array (so that each column
                # has one white pixel)
```
[Answer]
# Octave / MATLAB, ~~48~~ ~~37~~ 35 bytes
```
[~,z]=sort(rand(8,16));imshow(z==1)
```
Example (on Octave):
[![enter image description here](https://i.stack.imgur.com/0B797.png)](https://i.stack.imgur.com/0B797.png)
### Explanation
```
           rand(8,16)                  % 8×16 matrix of random values with uniform
                                       % distribution in (0,1)
[~,z]=sort(          );                % Sort each column, and for each output the
                                       % indices of the sorting. This gives an 8×16
                                       % matrix where each column contains a random
                                       % permutation of the values 1,2,...,8 
                              z==1     % Test equality with 1. This makes all values 
                                       % except 1 equal to 0
                       imshow(    )    % Show image, with grey colormap
```
[Answer]
# Processing, ~~74~~ 73 bytes
```
fill(0);rect(0,0,15,7);stroke(-1);for(int i=0;i<16;)point(i++,random(8));
```
Sample output:
[![enter image description here](https://i.stack.imgur.com/U96KB.png)](https://i.stack.imgur.com/U96KB.png)
### Explanation
```
fill(0);               //sets the fill colour to black
rect(0,0,15,7);        //draws a 16*8 black rectangle
stroke(-1);            //set stroke colour to white
for(int i=0;i<16;)     // for-loop with 16 iterations
 point(i++,random(8)); //  draw a point at x-coordinate i and a random y coordinate
                       //  the colour of the point is white since that is the stroke colour
```
[Answer]
# HTML+JavaScript, 148 bytes
```
c=O.getContext`2d`;for(x=16;x--;){r=Math.random()*8|0;for(y=8;y--;)c.fillStyle=y-r?'#000':'#fff',c.fillRect(x,y,1,1)}
```
```
<canvas id=O width=16 height=8>
```
[Answer]
# Befunge, 90 bytes
This generates a PBM file written to stdout.
```
>030#v_\2*>>?1v
:v9\$<^!:-1\<+<
|>p1+:78+`!
>"P",1..8.28*8*v
.1-\88+%9p:!#@_>1-::88+%9g:!!
```
[Try it online!](http://befunge.tryitonline.net/#code=PjAzMCN2X1wyKj4+PzF2Cjp2OVwkPF4hOi0xXDwrPAp8PnAxKzo3OCtgIQo+IlAiLDEuLjguMjgqOCp2Ci4xLVw4OCslOXA6ISNAXz4xLTo6ODgrJTlnOiEh&input=)
**Explanation**
The top three lines make up the random number generator, storing 16 random 3-bit numbers (i.e. in the range 0-7) on the tenth line of the playfield. Line four writes out the PBM header, and the last line then generates the pixels of the image. This is done by counting down the 16 random numbers as the pixels are output - when the number corresponding to a particular column reaches zero we output a 1 rather than a 0.
Sample output (zoomed):
![Sample output](https://i.stack.imgur.com/KfajO.png)
[Answer]
# Mathematica, ~~77~~ 60 bytes
```
Image[{RandomInteger@7+1,#}->1&~Array~16~SparseArray~{8,16}]
```
**Sample Output**
[![enter image description here](https://i.stack.imgur.com/AtiML.png)](https://i.stack.imgur.com/AtiML.png)
**Explanation**
```
{RandomInteger@7+1,#}->1&~Array~16
```
Make replacement rules for each column; replace a randomly selected position with 1.
```
... ~SparseArray~{8,16}
```
Create a `SparseArray` with size 8x16 from the replacement rules. The background is `0` by default. (8x16 because Mathematica counts rows first)
```
Image[ ... ]
```
Convert the `SparseArray` into an `Image` object.
**77 byte version**
```
ReplacePixelValue[Image@(a=Array)[0&~a~16&,8],{#,RandomInteger@7+1}->1&~a~16]
```
[Answer]
# R, 76 bytes
```
a=matrix(0,8,16);for(i in 1:16)a[sample(1:8,1),i]=1;png::writePNG(a,'a.png')
```
Uses package [`png`](https://cran.r-project.org/web/packages/png/index.html) to output to a file.  
Example output:
[![enter image description here](https://i.stack.imgur.com/Ce3Z8.png)](https://i.stack.imgur.com/Ce3Z8.png)
[Answer]
# QBasic, 59 bytes
```
RANDOMIZE TIMER
SCREEN 9
FOR x=0TO 15
PSET(x,RND*8-.5)
NEXT
```
Pretty straightforward. The `-.5` is needed because `PSET` with non-integer arguments uses round-to-nearest instead of floor or truncate (and `-.5` is shorter than `INT()`).
The image in question is displayed at the top left corner of the output window. A (cropped) example: [![16 random dots](https://i.stack.imgur.com/Ra4p4.png)](https://i.stack.imgur.com/Ra4p4.png)
[Answer]
# Java, (*Does it even matter* Bytes, AKA 244 + 18 import = 262)
```
import java.awt.*;static void l(){new Frame(){public void paint(Graphics g){int x=50;int i=16;g.setColor(Color.BLACK);g.fillRect(x,x,16,8);g.setColor(Color.WHITE);for(;i>0;i--){int y=(int)(Math.random()*8);g.drawLine(x+i,x+y,x+i,x+y);setVisible(1>0);}}}.show();}
```
Was wonky because the coordinate system includes the frame window pane... So you need to buffer by at least 26 bytes or nothing shows up, hence the `x=50` bit.
[Answer]
# Postscript (65 bytes)
```
0 0íkà0ícà8íc0 8ícííB1à1íù16{0 randàíj0.5í©ík1 0íÖíß1 0í≠}íÉ
```
Ungolfed version:
```
0 0 moveto
16 0 lineto
16 8 lineto
0 8 lineto
closepath
fill
1 1 1 setrgbcolor
16{0 rand 16 mod 0.5 sub moveto 1 0 rlineto stroke 1 0 translate}repeat
```
[Answer]
# SmileBASIC, 30 bytes
```
FOR I=0TO 15GPSET I,RND(8)NEXT
```
[Answer]
# Chip-8, 12 bytes
```
0xA201 'Load sprite at address 201 (which is the second byte of this instruction)
0xC007 'Set register 0 to a random number from 0 to 7 (rnd & 0x7)
0xD101 'Draw sprite. x = register 1, y = register 0, height = 1
0x7101 'Add 1 to register 1
0x3110 'If register 1 is not 16...
0x1202 'Jump to second instruction
```
Draws the image on the screen.
[Answer]
# Tcl/Tk, 163
Two different approaches render to the same byte extent:
```
grid [canvas .c -w 16 -he 8 -bg #000 -highlightt 0]
.c cr i 8 4 -i [set p [image c photo -w 16 -h 8]]
set x 0
time {$p p #FFF -t $x [expr int(rand()*8)];incr x} 16
```
---
```
grid [canvas .c -w 16 -he 8 -bg #000 -highlightt 0]
.c cr i 8 4 -i [set p [image c photo -w 16 -h 8]]
time {$p p #FFF -t [expr [incr x]-1] [expr int(rand()*8)]} 16
```
[![enter image description here](https://i.stack.imgur.com/VHIRb.png)](https://i.stack.imgur.com/VHIRb.png)
[Answer]
**VBA Excel, ~~86~~ 105 bytes**
using immediate window
```
Cells.RowHeight=42:[a1:p8].interior.color=0:for x=0to 15:[a1].offset(rnd*7,x).interior.color=vbwhite:next
```
]