#nvidia #cuda #gpu #driver #run-time

baracuda-curand

Safe Rust wrappers for NVIDIA cuRAND (pseudo- and quasi-random number generation)

58 releases

Uses new Rust 2024

0.0.1-alpha.78 Jul 31, 2026
0.0.1-alpha.77 Jul 10, 2026
0.0.1-alpha.72 Jun 29, 2026
0.0.1-alpha.62 May 31, 2026
0.0.1-alpha.5 Apr 29, 2026

#2843 in Hardware support

Download history 26/week @ 2026-06-09 164/week @ 2026-06-16 319/week @ 2026-06-23 228/week @ 2026-06-30 274/week @ 2026-07-07 67/week @ 2026-07-14 55/week @ 2026-07-21

397 downloads per month
Used in baracuda

MIT/Apache

1MB
22K SLoC

baracuda-curand

Safe Rust wrappers for NVIDIA cuRAND — GPU pseudo-random and quasi-random number generation.

use baracuda_curand::{Generator, RngKind};
use baracuda_driver::{Context, Device, DeviceBuffer};

# fn demo() -> Result<(), Box<dyn std::error::Error>> {
let ctx = Context::new(&Device::get(0)?)?;
let mut buf: DeviceBuffer<f32> = DeviceBuffer::new(&ctx, 1024)?;

let mut rng = Generator::new(RngKind::Default)?;
rng.seed(0xDEAD_BEEF)?;
rng.uniform(&mut buf)?;
# Ok(()) }

Coverage

  • All RNG kinds: XORWOW, MRG32k3a, MTGP32, Philox4_32_10, MT19937, Sobol32 / Sobol64, Scrambled Sobol32 / 64.
  • All distributions: uniform / uniform-double, normal / normal-double, log-normal / log-normal-double, Poisson, binomial. Quasi-random variants where applicable.
  • Stream-async generation: Generator::set_stream for per-stream dispatch.
  • Determinism controls: seed, set_offset, set_ordering.

Quasi-random support

For Sobol generators, baracuda-curand exposes set_quasi_random_dimensions, direction_vectors_32 / _64, and scramble_constants_32 / _64 so you can drive the sequence with the same direction vectors NVIDIA ships.

Pairs with baracuda-curand-sys for the raw FFI surface.

Part of the baracuda workspace.

License

Dual MIT / Apache-2.0.

Dependencies

~0.9–1.3MB
~31K SLoC