Future and e.g. Future.randjump

help?> Future
search: Future

  The Future module implements future behavior of already existing functions, which will replace the current version in a future release of Julia.

[When?! And this is a rather cryptic sentence; to newbies.]

help?> Future.randjump
  randjump(r::MersenneTwister, steps::Integer) -> MersenneTwister

  Create an initialized MersenneTwister object, whose state is moved forward (without generating numbers) from r by steps steps. One such step corresponds to the generation of two Float64
  numbers. For each different value of steps, a large polynomial has to be generated internally. One is already pre-computed for steps=big(10)^20.

I’m not sure randjump is missing, for current rand, or just not needed for it, since only implemented to MersenneTwister. I though it legacy, so was surprised to see PR updating it now. And it led me to the Future. Not to be confused with Distributed.Future:

julia> using Distributed
WARNING: using Distributed.Future in module Main conflicts with an existing identifier.

help?> Future.copy!
  Future.copy!(dst, src) -> dst

  Copy src into dst.

  │ Julia 1.1
  │
  │  This function has moved to Base with Julia 1.1, consider using copy!(dst, src) instead. Future.copy! will be deprecated in the future.

I believe the only two Future methods.

Some packages are using Future.copy! for real, DataFrames.jl is using it but not really. Maybe most “users” aren’t really using either only referencing like this one:

I only find this PR (don’t what do track down when first added):

Is Future from pre-1.0 Julia (that that PR later, just don’t want to track it dfown), meant for something like Python’s from future import?

It’s implemented for MersenneTwister and for Xoshiro, but only the former has a (semi)-public method, in the Future module. The PR you saw is likely the one bringing a Random.jump function which publicise a method for both, with a new API.

Yes essentially. IIRC, it was for APIs from v0.6 which we wanted to change, so they were removed in v1.0, while the new behavior was implemented in Future, with the idea of moving it back in Base in v1.1. It was so that a valid call in v0.6 wouldn’t silently do something different in v1.0; instead, this would be an error, letting user know that the old API was gone. The point was to allow opting-in the new behavior in v1.0 without waiting for v1.1. But in the case of randjump, it was never brung back into Base (or Random).

Creating this Future module might not have been a great idea, and I’d view it as legacy indeed (which doesn’t mean it shouldn’t be updated, like in the mentioned PR).

1 Like

The PR mentioned was actually yours: MersenneTwister: clean up constructors by rfourquet · Pull Request #60185 · JuliaLang/julia · GitHub I didn’t mean there was any PR touching Future (or even needed; just leave it as is…?). I just meant I found Future after looking into your PR.

1 Like

Ok, I thought you were referring to this one: add `Random.jump(rng)` API by rfourquet · Pull Request #58353 · JuliaLang/julia · GitHub, which actually updates the Future module (slightly).

1 Like