Skip to content

.choice() - option to actually return the choice? #3

Description

@rhysstubbs

I am using the choice function in the following way:

  this.squash = hpjs.choice(methods.activation);

However, the choice function returns an object, the documentation makes out as if a random element in the array is returned. Am I misusing the function?

NB: I know that this could be achieved manually, but I am using the library so it makes sense to utilise functions that are available. The manual way could be:

this.squash = methods.activation[Object.keys(methods.activation)[Math.floor(Math.random() * Object.keys(methods.activation).length)]];

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions