Theme Catppuccin
Make yourself at homeCatppuccin

A softer light for long learning sessions.

Appearance

Loading your preference…

Dark palette

Choose a dark palette to try it.

Light uses Latte. Your choices stay in this browser.

Randomness you can replay

SKETCHBOOK / 02 The Lantern Room · 2-week chapter

Page 1 of 3: An RNG belongs to a sample stream

State / reproducibility

An RNG belongs to a sample stream

The companion uses an explicit SplitMix64 integer generator with an owned 64-bit state. Its algorithm and attribution are documented. The high 53 bits map to a half-open double interval. This is a useful deterministic teaching stream, not a cryptographic generator or an assertion of independent streams.

Keep generator state local to a pixel/sample stream instead of sharing one mutable generator across workers. A global lock can make the stream depend on task scheduling, which turns a rendering bug into a difficult moving target. Reproducibility needs a defined seed policy and sample dimension order, not merely a constant somewhere in main. Draw u and v in separate statements before passing them to a sampler: function-argument evaluation order does not choose those dimensions for you.

For your renderer, initially run one worker and record a tuple such as pixel, sample index, and base seed. If you later hash that tuple into a stream seed, identify the mixing algorithm and test its reproducibility. Distinct seeds alone do not prove statistical independence, so avoid turning a convenient implementation choice into a statistical claim.

From the page to your own work

Your studio assignment.

Build a replayable sampling notebook for your renderer.

A finish line you can see

An original sampler plot, deterministic seed tests, and an equal-budget estimator comparison.

  1. Retain the documented RNG attribution.
  2. Test half-open endpoints and a non-finite rejection.
  3. Label local/world sampling frames.
  4. Record more than one seed when comparing error.
Keep the evidence in your weekly notebook ↗
Explain it like an engineer

Try answering aloud before opening the review notes. Use your own implementation as evidence.

Why can a deterministic renderer change when worker count changes?
  • A shared stream can be consumed in scheduling order.
  • Sample identity must be independent of task arrival.
  • Floating-point reduction order is another independent source of change.

These prompts support practice; they are not an automatic assessment of your work.

A small creative variation ↗

Add a tiny stratified integrator without changing the companion RNG.

Optional. Save it for later if this chapter already feels full.

Coming back after a break? ↩

Repeat the first three draws from one seed and compare them with your last note.

Books & principles behind this study +

Original Parallax explanations and assignments, with these works for further reading.

YOUR MARGIN NOTES

Leave yourself a good question.

What changed your mind? What would you try next?

Notes are private to this browser and saved as you write.

A CHECKPOINT, NOT A SCORE

Can you explain the idea and try the exercise yourself?

Completion records your own assessment. It does not compile or test your C++.
Companion source 10 files