1
$\begingroup$

Math newbie here. I am having some difficulties figuring out how to stochastically sample a range of UV points.

example: [ (u,v) | v <- [5..-5], u <- [-7..7] ]

I would need to make sure this works for any possible range of numbers. And the only way I know how to explain this next part is: If my current U is 3 (regarding the list comprehension above), I would need to make sure the newly generated number is still between 2 and 4.. This same restriction would need to apply regardless of the size and scale of the range. So if it was 20 points between -0.5 and 0.5, and I need to jitter point 0.35, it would need to stay in between 0.3 and 0.4 ..

For my situation, I can randomly generate numbers between either [0..1] or [-1..1].

Sorry for such a elementary explanation. My mathematic vocabulary is limited to what I know through programming. I am trying to teach myself both the basics of ray tracing and a new language (Haskell).

Any help would be greatly appreciated. Even if its just the general name/terminology for what I'm trying to accomplish.

0 Answers 0