Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve documentation for random #17015

Merged
merged 4 commits into from
Feb 12, 2021
Merged

Improve documentation for random #17015

merged 4 commits into from
Feb 12, 2021

Conversation

konsumlamm
Copy link
Contributor

  • use runnableExamples
  • other minor changes

I noticed that the documentation for initRand(int64) is generated twice (see #16953 (comment)), if anybody knows a workaround for this, please let me know.

Use runnableExamples
Minor changes
@timotheecour
Copy link
Member

timotheecour commented Feb 11, 2021

I noticed that the documentation for initRand(int64) is generated twice (see #16953 (comment)), if anybody knows a workaround for this, please let me know.

we should simply fix the compiler instead of using a workaround. Shouldn't be too hard IMO

EDIT: but please file a bug, ideally with a minimized example

lib/pure/random.nim Outdated Show resolved Hide resolved
lib/pure/random.nim Outdated Show resolved Hide resolved
lib/pure/random.nim Outdated Show resolved Hide resolved
@konsumlamm
Copy link
Contributor Author

I noticed that the documentation for initRand(int64) is generated twice (see #16953 (comment)), if anybody knows a workaround for this, please let me know.

we should simply fix the compiler instead of using a workaround. Shouldn't be too hard IMO

EDIT: but please file a bug, ideally with a minimized example

Done, see #17016.

lib/pure/random.nim Outdated Show resolved Hide resolved
## * `stats module<stats.html>`_ for statistical analysis
## * `list of cryptographic and hashing modules
## <lib.html#pure-libraries-hashing>`_
## * `std/sysrand module <sysrand.html>`_ for a cryptographically secure pseudorandom number generator
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## * `std/sysrand module <sysrand.html>`_ for a cryptographically secure pseudorandom number generator
## * `std/sysrand module <sysrand.html>`_ for a cryptographically secure pseudorandom number generator (CSPRNG)

## * `rand proc<#rand,Rand,Natural>`_ that returns an integer
## * `rand proc<#rand,Rand,HSlice[T: Ordinal or float or float32 or float64,T: Ordinal or float or float32 or float64]>`_
## that accepts a slice
## * `rand proc<#rand,typedesc[T]>`_ that accepts an integer or range type
runnableExamples:
var r = initRand(234)
let f = r.rand(1.0)
## f = 8.717181376738381e-07
let f = r.rand(1.0) # 8.717181376738381e-07
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pre-existing but that's a bug (doesn't affect this PR though); will explain later

Copy link
Member

@timotheecour timotheecour Feb 12, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lib/pure/random.nim Outdated Show resolved Hide resolved
Copy link
Member

@timotheecour timotheecour left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM; remaining points can be addressed in future PRs

@Araq Araq merged commit f57774e into nim-lang:devel Feb 12, 2021
@konsumlamm konsumlamm deleted the random branch February 14, 2021 14:37
ardek66 pushed a commit to ardek66/Nim that referenced this pull request Mar 26, 2021
* Improve documentation for random

Use runnableExamples
Minor changes

* Apply suggestions

Remove echo
Use RNG in more places

* Fix skipRandomNumbers example
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants