Skip to content

alpha-convert/unboxed-splitmix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Splittable Random Number Generation with Unboxed Types

This is verbatim reimplementation of Jane Street's Splittable_random RNG library, which is in turn an implementation of the splitmix paper.

The only difference between this library and Splittable_random is that this one uses unboxed types and locals from the Jane Street bleeding-edge compiler branch. The implementation of the splitmix algorithm in Splittable_random uses the following type to encode the RNG state:

type t = { mutable seed : int64; odd_gamma : int64 }

Because int64 has kind value, this data structure includes two un-needed boxes for the two fields, and every arithmetic or logical operation the library does to compute on int64s must unbox and re-allocate these values.

This library instead uses the following type, which lets us implement all of the bit arithmetic with machine instructions and no allocation.

type t = { mutable seed : int64#; odd_gamma : int64# }

Dependencies

Builds on OCaml with Jane Street extensions

About

A port of splittable_random using unboxed int64s.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published