Judge Some Titrations

In chemistry class, we were learning about titrations, and attempting one as a lab. We were using phenolphthalein as the indicator for the titration, so on top of grading the lab normally, my teacher held a little contest to see who had the lightest shade of pink, and thus the most accurate transition.

Your task is to write a program that acts like the teacher and judges the titrations.

Specs

As input, you take a list of RGB triples in any sane format representing the titration of each student. ex: ["D966FF", "ECB3FF", "AC00E6"]. You will be guaranteed that if converted to HSL, the hue is 285 and the saturation is 100.

The conversion for RGB to HSL lightness is the average of the max and min of the normalized RGB components (*100 for a percentage).

Now the teacher is a human being and therefore cannot measure the lightness of the solution perfectly, so before you do any of the things described below, randomly change the lightness value of each of the titrations by ±3, uniformly distributed.

If a titration has a lightness value greater than 94, it is too light to visibly see that all the acid has neutralized. Therefore, the first output is a list, sorted in descending order, of all the titrations whose RGB triples, when converted to HSL, yield a lightness value less than 94. This represents the results of the contest.

The other output is a list of all the people who have failed the lab. This includes the people with the lightness values greater than 94, but also people whose lightness values are less than or equal to 65 because these people's titrations are too inaccurate.

This is , so shortest code in bytes win.

Test Cases

These test cases all assume that the error is always 0 for ease in checking if your program is correct. The results from your program should be different each time you run it.

["D966FF", "ECB3FF", "AC00E6"] -> ["ECB3FF", "D966FF", "AC00E6"], ["AC00E6"]
["EDB8FF", "D761FF", "9100C2", "FBEFFF"] -> ["EDB8FF", "D761FF", "9100C2"], ["FBEFFF", "9100C2"]
["F5D6FF"] -> ["F5D6FF"], []

• @PeterTyler Actually, only one of them is wrong invalid, and that is the fourth element in the 2nd test case, which evaluates to 284º instead of 285º when converted to HSL. – R. Kap May 22 '16 at 0:08
• @PeterTaylor It's fixed now. – R. Kap May 22 '16 at 4:06

Pyth, 35 34 bytes

L+O32+eSbhSbf<yTJ495Qf|gyTJ<yT347Q


Test suite.

Previous 35-byte version:

L+O32+eSbhSbf<yT495Qf|gyT495<yT347Q


Test suite.

Verify that the third testcase is not the same for each run.

Sample input/output:

input:
[[217, 102, 255], [236, 179, 255], [172, 0, 230]]
output:
[[217, 102, 255], [236, 179, 255], [172, 0, 230]]
[[172, 0, 230]]


Explanation

(max/255 + min/255)/2 + random[-0.03 .. 0.03] >= 0.94
(max/255 + min/255) + random[-0.06 .. 0.06] >= 1.88
max + min + random[-15 .. 15] >= 479.4
max + min + random[0 .. 31] >= 494.4
max + min + random[0 .. 31] >= 495

(max/255 + min/255)/2 + random[-0.03 .. 0.03] <= 0.65
(max/255 + min/255) + random[-0.06 .. 0.06] <= 1.30
max + min + random[-15 .. 15] <= 331.5
max + min + random[0 .. 31] <= 346.4
max + min + random[0 .. 31] < 347

L+O32+eSbhSbf<yT495Qf|gyT495<yT347Q
@memoized
L                                    def y(b):
+O32                                    return random(range(32)) +
+eSb                                b.sort[-1] +
hSb                             b.sort[0]
f      Q                 filter for elements in Q as T:
<yT495                      y(T) < 495
(implicitly printed)
f             Q  filter for elements in Q as T
|gyT495             y(T) >= 495 or
<yT347       y(T) < 347
(implicitly printed)


Before you complain that it calls random three times, hence having inconsistent outputs from the function, note that the function is memoized.

Before you complain that different students with the same colour always produce the same outcome, note that the question never said that the random generator must be independent. It must only be uniform.