diku-dk / cpprandom Goto Github PK
View Code? Open in Web Editor NEWA Futhark library in the style of C++'s <random>
License: ISC License
A Futhark library in the style of C++'s <random>
License: ISC License
For example, this program will not terminate:
import "lib/github.com/diku-dk/cpprandom/random"
module rng = minstd_rand
module dist = uniform_int_distribution u32 rng
let main (seed: i32) =
let r = rng.rng_from_seed [seed]
in dist.rand (rng.min,rng.max+1) r
The problem is this loop where it tries to ensure that the distribution is not unbalanced. If the range is too great, then secure_max
becomes 0, and the loop becomes infinite.
Both book and comment say join_rngs
but in code I see only join_rng
defined.
uniform_int_distribution i64 minstd_rand
generates numbers outside the range when the range is between negative numbers.
import "lib/github.com/diku-dk/cpprandom/random"
module dist = uniform_int_distribution i64 minstd_rand
let snd (_,b) = b
let main = snd <| dist.rand (-20,-10) (minstd_rand.rng_from_seed [1234])
This program returns 4294967281i64
, for example
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.