Skip to content

Allow combining Get-Random -Count with (implied) -Minimum / -Maximum to create multiple random values #8986

Closed

Description

Summary of the new feature/enhancement

Currently, you can only obtain multiple values with -Count if you supply an input collection to select random elements from.

However, sometimes you want to generate multiple random values from a given range, such as "generate 3 random values in the range 0 to 1":

# WISHFUL THINKING - currently, you have to call Get-Random in a *loop*.
PS> Get-Random -Maximum 1.0 -Count 3
0.00964209344687038
0.399765062797705
0.589964029188251

Proposed technical implementation details

Allow combining parameter -Count with (implied) -Minimum and /or -Maximum as well, in which case -Count simply specifies how many values in the range to generate.

Activity

  1. added
    Issue-Enhancement
    on Feb 26, 2019
  2. iSazonov commented on Feb 26, 2019

    @iSazonov
    Collaborator

    What output type is expected? Int? Double?

  3. vexx32 commented on Feb 26, 2019

    @vexx32
    Collaborator

    Whatever the input type for mininum/maximum is, is it not? I believe Get-Random dynamically determines that based upon input.

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

    Issue-EnhancementResolution-FixedWG-Cmdlets

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions