| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
| |
|
| |
|
|
|
|
| |
Add docs for the sample procs that take in sets, and clean up a
few other minor things.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
| |
* Render deprecated pragmas
* fix the expected html
* clean up the documentation regarding deprecations
* fix typo
* fix system.nim
* fix random
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
* Support for sets
* Rename 'rand' to 'sample'
* Update random.nim
|
|
|
|
| |
(#10635)
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Resolve things raised in https://github.com/nim-lang/Nim/issues/10081 ?
CDF is a standard ident in all things related to random numbers/sampling,
and full words "cumulativeDistributionFunction" would be silly long, in
this case, IMO. We use lowercase `cdf` to make it not look like a type,
remove all looping from `sample` letting callers do it. Besides just
side-stepping any `sampleSize` name choice, callers may want to filter
out samples anyway which this makes slightly simpler.
Also add two variants of `cumsum`, value return and in-place update
distinguished by the var-ness of the first argument. Add tests for
`int` and `float` for both `cumsum` and the new `sample`. (The sample
tests exercise the value return mode of `cumsum`.)
Functionality pre-this-PR `sample(a, w)` is now the almost as simple
`for i in 0..<n: sample(a, w.cumsum)`, but this new code factoring is
almost surely better. The statistical tests pass, as before.
* Address Araq comment in https://github.com/nim-lang/Nim/pull/10084
We can always add in some `var` version later if desired to save
memory, but this change now at least firms up the `sample` interface.
* Rename `cumsum` -> `cumsummed` to honor NEP1 style. Re-instate `cumsum` as
the in-place transformation. Test both in `tests/stdlib/tmath.nim` and use
`cumsummed` in the example code for sample since that's a simpler example.
* Fix requests from https://github.com/nim-lang/Nim/pull/10084 :
example in lib/pure/math.nim and comment whitespace in lib/pure/random.nim
|
|
|
| |
Fixes #9999.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(#10072)
* Add the ability to sample elements from an openArray according to a parallel
array of weights/unnormalized probabilities (any sort of histogram, basically).
Also add a non-thread safe version for convenience.
* Address Araq comments on https://github.com/nim-lang/Nim/pull/10072
* import at top of file and space after '#'.
* Put in a check for non-zero total weight.
* Clarify constraint on `w`.
* Rename `rand(openArray[T])` to `sample(openArray[T])` to `sample`, deprecating
old name and name new (openArray[T], openArray[U]) variants `sample`.
* Rename caller-provided state version of rand(openArray[T]) and also clean
up doc comments.
* Add test for new non-uniform array sampler. 3 sd bound makes it 99% likely
that it will still pass in the future if the random number generator changes.
We cannot both have a tight bound to check distribution *and* loose check to
ensure resilience to RNG changes. (We cannot *guarantee* resilience, anyway.
There's always a small chance any test hits a legitimate random fluctuation.)
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
* Rename `Time.nanoseconds` to `nanosecond`
* Fix bug with Duration comparision
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Add deprecation warnings to recently deprecated procs
* Fix bad usage of the times module
* Introduce sub second resolution
* Fix usage of C's time()
* Switch to nanosecond resolution
* Make Time & Duration opaque again and fix some errors
* Change back to TimeInterval for shorthands
* Fix JS test
* Fix build error for windows
* Undeprecate epochTime
* Documentation and minor changes
* Lots of bugfixes and doc comments
* Attempt to make travis & appveyor green
* Fix edge cases for dealing with the local timezone
* Workaround JS backend overflow/underflow bug
* Use better workaround for not knowing the size of time_t
* Use all available timezones for tests
* Fix indentation
* Add procs for accessing the fractional part of a duration
* Order time units from smallest to largest since it makes more sense
* Include months and years in `TimeUnit`
* Review fix
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* First work on better timezones
* Update tests to new api.
Removed tests for checking that `isDst` was included when formatting, since `isDst` no longer affects utc offset (the entire utc offset is stored directly in `utcOffset` instead).
* Deprecate getLocaltime & getGmTime
* Add `now()` as a shorthand for GetTIme().inZone(Local)
* Add FedericoCeratto's timezone tests (#6548)
* Run more tests in all timezones
* Make month enum start at 1 instead of 0
* Deprecate getDayOfWeekJulian
* Fix issues with gc safety
* Rename TimeInfo => DateTime
* Fixes #6465
* Improve isLeapYear
* FIx handling negative adjTime
* Cleanup:
- deprecated toSeconds and fromSeconds, added fromUnix and toUnix instead (that returns int64 instead of float)
- added missing doc comments
- removed some unnecessary JS specific implementations
* Fix misstake in JS `-` for Time
* Update usage of TimeEffect
* Removed unecessary use of `difftime`
* JS fix for local tz
* Fix subtraction of months
* Fix `days` field in `toTimeInterval`
* Style and docs
* Fix getDayOfYear for real this time...
* Fix handling of adding/subtracting time across dst transitions
* Fix some bad usage of the times module in the stdlib
* Revert to use proper time resoultion for seeding in random.nim
* Move deprecated procs to bottom of file
* Always use `epochTime` in `randomize`
* Remove TimeInterval normalization
* Fixes #6905
* Fix getDayOfWeek for year < 1
* Export toEpochDay/fromEpochDay and change year/month/monthday order
* Add asserts for checking that the monthday is valid
* Fix some remaining ambiguous references to `Time`
* Fix ambiguous reference to Time
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
regardless of randomize() (#5257)
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|