Skip to content

Commit

Permalink
Add docs for generic functions JuliaRandom#26 and fix "edit this page…
Browse files Browse the repository at this point in the history
…" links.
  • Loading branch information
sunoru committed Mar 9, 2017
1 parent ea7f88f commit 2758649
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 7 deletions.
1 change: 1 addition & 0 deletions docs/mkdocs.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
site_name: RandomNumbers.jl
repo_url: https://github.com/sunoru/RandomNumbers.jl
edit_uri: edit/master/docs/src/
site_description: Random number generators for Julia language.
site_author: Sunoru

Expand Down
14 changes: 14 additions & 0 deletions docs/src/lib/random-numbers.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,20 @@ end
Pages = ["random-numbers.md"]
```

## [Generic Functions](@id generic_funcions)
```@docs
rand
srand
randn
randexp
bitrand
randstring
randsubseq
shuffle
randperm
randcycle
```

## Public
```@autodocs
Modules = [RandomNumbers]
Expand Down
17 changes: 10 additions & 7 deletions docs/src/man/bases.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,20 @@ Consistent to what `Base.Random` does, there are generic functions:
initializes a RNG by one or a sequence of numbers (called *seed*). The output sequences by two RNGs of
the same type should be the same if they are initialized by the same seed, which makes them
*deterministic*. The seed type of each RNG type can be different, you can refer to the corresponding
manual pages for details. If no `seed` provided, then it will use [`RandomNumbers.gen_seed`](@ref) to get a "truly"
random one.
manual pages for details. If no `seed` provided, then it will use [`RandomNumbers.gen_seed`](@ref) to get
a "truly" random one.

- `rand(::AbstractRNG{T}[, ::Type{TP}=Float64])`
returns a random number in the type `TP`. `TP` is usually an `Unsigned` type, and the return value is
expected to be uniformly distributed in {0, 1} at every bit. When `TP` is `Float64` (as default), this
function returns a `Float64` value that is expected to be uniformly distributed in ``[0, 1)``. The discussion
about this is in the [Conversion to Float](@ref) section.

The other generic functions such as `rand(::AbstractRNG, ::Dims)` and `rand!(::AbstractRNG, ::AbstractArray)`
defined in `Base.Random` still work.
function returns a `Float64` value that is expected to be uniformly distributed in ``[0, 1)``. The
discussion about this is in the [Conversion to Float](@ref) section.

The other generic functions such as `rand(::AbstractRNG, ::Dims)` and
`rand!(::AbstractRNG, ::AbstractArray)`, and the ones that generate random numbers in a certain distribution
such as `randn`, `randexp`, `randcycle`, etc. defined in `Base.Random` still work well. However the
[official docs](http://docs.julialang.org/en/release-0.5/stdlib/numbers/#random-numbers) don't include all of
them, so you can refer to [this section](@ref generic_funcions) for details.

The constructors of all the types of RNG are designed to take the same kind of parameters as `srand`. For example:

Expand Down

0 comments on commit 2758649

Please sign in to comment.