gsl-ocaml / lib / rng.ml

(* gsl-ocaml - OCaml interface to GSL                        *)
(* Copyright (©) 2002-2005 - Olivier Andrieu                *)
(* Distributed under the terms of the GPL version 2         *)

type rng_type =
  | BOROSH13
  | COVEYOU
  | CMRG
  | FISHMAN18
  | FISHMAN20
  | FISHMAN2X
  | GFSR4
  | KNUTHRAN
  | KNUTHRAN2
  | KNUTHRAN2002
  | LECUYER21
  | MINSTD
  | MRG
  | MT19937
  | MT19937_1999
  | MT19937_1998
  | R250
  | RAN0
  | RAN1
  | RAN2
  | RAN3
  | RAND
  | RAND48
  | RANDOM128_BSD
  | RANDOM128_GLIBC2
  | RANDOM128_LIBC5
  | RANDOM256_BSD
  | RANDOM256_GLIBC2
  | RANDOM256_LIBC5
  | RANDOM32_BSD
  | RANDOM32_GLIBC2
  | RANDOM32_LIBC5
  | RANDOM64_BSD
  | RANDOM64_GLIBC2
  | RANDOM64_LIBC5
  | RANDOM8_BSD
  | RANDOM8_GLIBC2
  | RANDOM8_LIBC5
  | RANDOM_BSD
  | RANDOM_GLIBC2
  | RANDOM_LIBC5
  | RANDU
  | RANF
  | RANLUX
  | RANLUX389
  | RANLXD1
  | RANLXD2
  | RANLXS0
  | RANLXS1
  | RANLXS2
  | RANMAR
  | SLATEC
  | TAUS
  | TAUS_2
  | TAUS_113
  | TRANSPUTER
  | TT800
  | UNI
  | UNI32
  | VAX
  | WATERMAN14
  | ZUF

type t


external default : unit -> rng_type 
    = "ml_gsl_rng_get_default"
external default_seed : unit -> nativeint 
    = "ml_gsl_rng_get_default_seed"

external set_default : rng_type -> unit
    = "ml_gsl_rng_set_default"
external set_default_seed : nativeint -> unit
    = "ml_gsl_rng_set_default_seed"

external env_setup : unit -> unit 
    = "ml_gsl_rng_env_setup"

external create : rng_type -> t = "ml_gsl_rng_alloc"
external delete : t -> unit = "ml_gsl_rng_free"
let make rngtype = 
  let rng = create rngtype in
  Gc.finalise delete rng ;
  rng

external set : t -> nativeint -> unit = "ml_gsl_rng_set"
external name : t -> string = "ml_gsl_rng_name"
external max : t -> nativeint = "ml_gsl_rng_max"
external min : t -> nativeint = "ml_gsl_rng_min"
external get_type : t -> rng_type = "ml_gsl_rng_get_type"

external memcpy : t -> t -> unit = "ml_gsl_rng_memcpy"
external clone  : t -> t = "ml_gsl_rng_clone"

external dump_state : t -> string * string = "ml_gsl_rng_dump_state"
external set_state  : t -> string * string -> unit = "ml_gsl_rng_set_state"

external get : t -> nativeint = "ml_gsl_rng_get"
external uniform : t -> float = "ml_gsl_rng_uniform"
external uniform_pos : t -> float = "ml_gsl_rng_uniform_pos"
external uniform_int : t -> int -> int = "ml_gsl_rng_uniform_int" "noalloc"

external uniform_arr : t -> float array -> unit 
    = "ml_gsl_rng_uniform_arr" "noalloc"
external uniform_pos_arr : t -> float array -> unit 
    = "ml_gsl_rng_uniform_pos_arr" "noalloc"
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.