Giter Club home page Giter Club logo

elm-random-extra's Introduction

elm-random-extra

Extra functionality for the core Random library

elm-random-extra's People

Contributors

mgold avatar theseamau5 avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

elm-random-extra's Issues

Update for elm 0.18

I really wanna use this but it doesn't seem to be supported with elm 0.18

$ elm package install NoRedInk/elm-random-extra
To install NoRedInk/elm-random-extra I would like to add the following
dependency to elm-package.json:

    "NoRedInk/elm-random-extra": "2.1.1 <= v < 3.0.0"

May I add that to elm-package.json for you? [Y/n] 

Error: I cannot find a set of packages that works with your constraints.

--> There are no versions of NoRedInk/elm-random-extra that work with Elm
    0.18.0. Maybe the maintainer has not updated it yet.

Generate Sets of exact size?

I noticed this repository doesn't have any issues listed, but I'm posting here because it's more recent than its parent repository. Please let me know if I should ask it upstream.

I was looking at Random.Set's set generator for a function that would generate a set of a certain size, but it only makes sets of a maxlength.

Would it be in the scope of this library to have a function for sets of a specific size? I was thinking
something like Extra.generateN, but with set.union instead of :: on the last line.

{-| Generate N unique values from a generator. -}
generateSetN : Int -> Generator a -> Seed -> Set a -> Set a
generateSetN n generator seed current =
  if n <= 0
  then
      current
  else
      let 
        (value, nextSeed) = generate generator seed
        newSet = Set.insert value current
    in
        generateN (n - (length newSet)) generator nextSeed newSet

If this is something you'd like I can clean it up (check if it actually works), and make it a PR.

Cheers,
Amedee

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.