Commit Graph

12 Commits

Author SHA1 Message Date
Andrew Kelley
2b395d4ede
remove @minValue,@maxValue; add std.math.minInt,maxInt
closes #1466
closes #1476
2018-10-26 15:01:51 -04:00
Jimmi Holst Christensen
378d3e4403
Solve the return type ambiguity (#1628)
Changed container and initializer syntax
* <container> { ... } -> <container> . { ... }
* <exrp> { ... } -> <expr> . { ...}
2018-10-15 09:51:15 -04:00
Josh Wolfe
e7d9d00ac8 overhaul api for getting random integers (#1578)
* rand api overhaul
* no retry limits. instead documented a recommendation
  to call int(T) % len directly.
2018-09-27 00:35:38 -04:00
Matthew D. Steele
c2a08d7c51 Fix the start-less-than-end assertion in std.rand.Random.range (#1325)
The function returns a value in [start, end), but was asserting
start <= end instead of start < end.  With this fix, range(1, 1)
will now assertion error instead of dividing by zero.
2018-08-03 11:44:39 -04:00
tgschultz
3e94347e61 Fix up some std.rand syntax #1161 (#1162)
* Fix old syntax in rand

Ziggurat somehow did not get updated to latest syntax

* Fix broken float casts

f32 float casts somehow not updated to latest syntax
2018-06-27 12:30:15 -04:00
Andrew Kelley
7912061226 remove integer and float casting syntax
* add `@intCast`
 * add `@floatCast`
 * add `@floatToInt`
 * add `@intToFloat`

See #1061
2018-06-17 02:57:07 -04:00
Andrew Kelley
fcbb7426fa use * for pointer type instead of &
See #770

To help automatically translate code, see the
zig-fmt-pointer-reform-2 branch.

This will convert all & into *. Due to the syntax
ambiguity (which is why we are making this change),
even address-of & will turn into *, so you'll have
to manually fix thes instances. You will be guaranteed
to get compile errors for them - expected 'type', found 'foo'
2018-05-31 17:28:07 -04:00
Andrew Kelley
ea58f4a5a9 run zig fmt on the codebase 2018-05-30 16:09:11 -04:00
Andrew Kelley
0c16cd2d0e run zig fmt on the codebase
See #1003
2018-05-29 04:23:38 -04:00
Marc Tiehuis
c7cb5c31e5 Add exp/norm distributed random float generation 2018-04-16 20:06:50 +12:00
Andrew Kelley
ccadcbc715 fix examples and rename std.rand.Rand to std.rand.Random 2018-03-29 12:33:29 -04:00
Marc Tiehuis
0fd0f6fd1f Rewrite Rand functions
We now use a generic Rand structure which abstracts the core functions
from the backing engine.

The old Mersenne Twister engine is removed and replaced instead with
three alternatives:

 - Pcg32
 - Xoroshiro128+
 - Isaac64

These should provide sufficient coverage for most purposes, including a
CSPRNG using Isaac64. Consumers of the library that do not care about
the actual engine implementation should use DefaultPrng and DefaultCsprng.
2018-03-30 01:50:58 +13:00