diff options
| author | Gertjan van den Burg <gertjanvandenburg@gmail.com> | 2021-02-11 14:15:20 +0000 |
|---|---|---|
| committer | Gertjan van den Burg <gertjanvandenburg@gmail.com> | 2021-02-11 14:15:20 +0000 |
| commit | ceeb7283a07c498c583b99007722b728677d0e21 (patch) | |
| tree | 519d9a6d6c8cb9aed467c4bdf97595fa8b605d7a | |
| parent | Minor readme fixes (diff) | |
| download | SyncRNG-ceeb7283a07c498c583b99007722b728677d0e21.tar.gz SyncRNG-ceeb7283a07c498c583b99007722b728677d0e21.zip | |
| -rw-r--r-- | README.md | 16 |
1 files changed, 8 insertions, 8 deletions
@@ -109,7 +109,7 @@ class: Functionality is deliberately kept minimal to make maintaining this library easier. It is straightforward to build more advanced applications on the -existing methods, as the following examples shows. +existing methods, as the examples below show. ### R: User defined RNG @@ -132,9 +132,11 @@ implementation for these functions. Using random number primitives from SyncRNG directly is therefore generally more reliable. See the examples below for sampling and generating normally distributed values with SyncRNG. - ## Examples +This section contains several examples of functionality that can easily be +built on top of the primitives that SyncRNG provides. + ### Sampling without replacement Sampling without replacement can be done by leveraging the builtin ``shuffle`` @@ -162,10 +164,10 @@ Python: ### Sampling with replacement -Sampling with replacement requires us to generate a random index for the -array. Note that these values are not (necessarily) the same as what is -returned from R's ``sample`` function, even if we specify SyncRNG as the -user-defined RNG (see above). +Sampling with replacement simply means generating random array indices. Note +that these values are not (necessarily) the same as what is returned from R's +``sample`` function, even if we specify SyncRNG as the user-defined RNG (see +above). R: ```r @@ -203,7 +205,6 @@ transform](https://en.wikipedia.org/wiki/Box%E2%80%93Muller_transform) to generate normally distributed samples. R: - ```r library(SyncRNG) @@ -241,7 +242,6 @@ syncrng.box.muller <- function(mu, sigma, n, seed=0, rng=NULL) ``` Python: - ```python import math from SyncRNG import SyncRNG |
