For example, for a 50mm lens with an f-stop of 4.0 focused at 2 meters:
lens 0.050 4.0 2.0
Calculate aperature from focal length and f-stop
in your original code, when you've calculated a ray to trace, to do Depth of Field:
compute the intersection, p, of the ray with a plane that is "focus distance" away - the focal plane point of intersection; if F is the focus distance, ray = s + t*d, and 'w' is the view direction vector, then F=t*d.w; solve for t and compute p
perturb a copy of the camera position in u and v directions randomly within aperature distance - this is the new ray source point
form the new ray's direction as the vector from the new ray source point to the focal plane point of intersection, p, calculated above; normalize the new ray direction