Pmj
Rust implementation of "Progressive Multi-Jittered Sample Sequences"
Install / Use
/learn @sjb3d/PmjREADME
Progressive Multi-Jittered Sample Sequences
A crate to generate pmj02 and pmj02b sample sequences as described in the following papers:
- Progressive Multi-Jittered Sample Sequences by Christensen et al.
- Efficient Generation of Points that Satisfy Two-Dimensional Elementary Intervals by Matt Pharr.
Usage
use pmj::{generate, Sample};
use rand::prelude::*;
use rand::rngs::SmallRng;
fn main() {
// generate 4096 samples uing SmallRnd from the rand crate
let mut rng = SmallRng::seed_from_u64(0);
let samples = generate(4096, 0, &mut rng);
// print coordinates
for s in &samples {
println!("sample: {}, {}", s.x(), s.y());
}
}
Performance seems to be comparable to the figures stated in the second paper. Generating 4096 points as above takes around 4.8ms on a 1.7GHz CPU (compared to 3.19ms on a 4GHz CPU stated in the paper).
Examples
The measure example measures the integration convergence rate (averaged over 100 sequences) for the "disc" and "bilinear" functions in the first paper:

The plot example produces svg images to inspect the stratification and classes of the generated samples. Here is the output showing the stratification of a single sequence when looking at the first 4/8/16/32 samples:

Here is the output showing the first 1024 samples split into 2 or 4 classes:

Related Skills
node-connect
352.0kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
111.1kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
352.0kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
352.0kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
