When calling sample(1:length(w), Weights()) with a Float32-weight vector w that includes some zero weights, it still can happen that an element with weight zero is returned.
More specifically, length(w) is returned with a probability of roughly 1/10,000,000 in my case of a 300 element weight vector with about 30 elements != 0. It seems this is the case due to some mathematical rounding issue.
Of course, if one knows this, it can easily be prevented by excluding the elements with probability zero, but I did not expect this behavior and was wondering why in my ML-application invalid actions that were masked out have been selected.