HN user

rtu8lu

5 karma
Posts0
Comments4
View on HN
No posts found.

Not really. There are many ways depending on your needs. For example, you can partition your space first, then generate randomly inside each of the subspaces. Let's say I need 200 numbers from -1000 to 999. The first range will be 0 to +99, the second -1 to -100, then +100 to +199, and so on. So, to generate a random number I just need an index and the bounds.

Great project. I used it a lot, but now I mostly prefer ad hoc generators. Hypothesis combinators quickly become unmaintainable mess for non-trivial objects. Also, shrinking is not such a big deal when you can generate your data in a complexity-sorted order.

I have something like this in my overlays.nix:

  self: super:
  
  let
    callPackage = super.callPackage;
  in {
    darktable = callPackage
      ./pkgs/darktable { inherit (super) darktable; };
  }
And my default.nix in pkgs/darktabele looks like this:
  { darktable, fetchurl, ... }:
  
  darktable.overrideAttrs (_: rec {
    version = "3.0.0";
    src = fetchurl {
      url = "https://github.com/darktable-org/darktable/releases/download/release-${version}/darktable-${version}.tar.xz";
      sha256 = "7195a5ff7ee95ab7c5a57e4e84f8c90cc4728b2c917359203c21293ab754c0db";
    };
  })