Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|cite|improve this question

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.