Skip to content

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

@mklement0

Description

@mklement0

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Enhancementthe issue is more of a feature request than a bugResolution-FixedThe issue is fixed.WG-Cmdlets-Utilitycmdlets in the Microsoft.PowerShell.Utility module

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions