SIMPLE SOLUTIONS

# RANDOM(3O) - Linux man page online | Library functions

Pseudo-random number generators (PRNG).

Chapter
source:
Random(3o) OCamldoc Random(3o)

## NAME

Random - Pseudo-random number generators (PRNG). Module Module Random Documentation Module Random : sig end Pseudo-random number generators (PRNG). === Basic functions === val init : int -> unit Initialize the generator, using the argument as a seed. The same seed will always yield the same sequence of numbers. val full_init : int array -> unit Same as Random.init but takes more data as seed. val self_init : unit -> unit Initialize the generator with a random seed chosen in a system-dependent way. If /dev/urandom is available on the host machine, it is used to provide a highly random ini‐ tial seed. Otherwise, a less random seed is computed from system parameters (current time, process IDs). val bits : unit -> int Return 30 random bits in a nonnegative integer. Before3.12.0 used a different algorithm (affects all the following functions) val int : int -> int Random.int bound returns a random integer between 0 (inclusive) and bound (exclusive). bound must be greater than 0 and less than 2^{30. val int32 : Int32.t -> Int32.t Random.int32 bound returns a random integer between 0 (inclusive) and bound (exclusive). bound must be greater than 0. val nativeint : Nativeint.t -> Nativeint.t Random.nativeint bound returns a random integer between 0 (inclusive) and bound (exclu‐ sive). bound must be greater than 0. val int64 : Int64.t -> Int64.t Random.int64 bound returns a random integer between 0 (inclusive) and bound (exclusive). bound must be greater than 0. val float : float -> float Random.float bound returns a random floating-point number between 0 and bound (inclusive). If bound is negative, the result is negative or zero. If bound is 0, the result is 0. val bool : unit -> bool Random.bool () returns true or false with probability 0.5 each. === Advanced functions === === The functions from module Random.State manipulate the current state of the random gen‐ erator explicitly. This allows using one or several deterministic PRNGs, even in a multi-threaded program, without interference from other parts of the program. === module State : sig end val get_state : unit -> State.t Return the current state of the generator used by the basic functions. val set_state : State.t -> unit Set the state of the generator used by the basic functions.
2017-10-20 source: Random(3o)
{"ft_lang_label":"__label__en","ft_lang_prob":0.7131823,"math_prob":0.98588765,"size":2334,"snap":"2021-04-2021-17","text_gpt3_token_len":562,"char_repetition_ratio":0.14377682,"word_repetition_ratio":0.16137566,"special_character_ratio":0.2536418,"punctuation_ratio":0.15022421,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9825582,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2021-04-22T17:25:26Z\",\"WARC-Record-ID\":\"<urn:uuid:89b0ec69-84d6-4ba9-98b5-9ea1a18f3ab2>\",\"Content-Length\":\"10462\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:4f8f1143-9ef2-42e0-83d1-cccb75370256>\",\"WARC-Concurrent-To\":\"<urn:uuid:b2823cc3-b889-403c-87ab-98e2f97722d4>\",\"WARC-IP-Address\":\"217.182.169.17\",\"WARC-Target-URI\":\"https://www.venea.net/man/Random(3o)\",\"WARC-Payload-Digest\":\"sha1:4ZK2HBMBWY2FEW4WNJBZJ24XBO4NICGA\",\"WARC-Block-Digest\":\"sha1:WPJHHRQNJGBJHJOVXJQY67DZ6MIGWD2W\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2021/CC-MAIN-2021-17/CC-MAIN-2021-17_segments_1618039594341.91_warc_CC-MAIN-20210422160833-20210422190833-00489.warc.gz\"}"}