Skip to content

Set a property value from a random value (generate random values). #146

@end2endzone

Description

@end2endzone

Is your feature request related to a problem? Please describe.
Scripting usually requires to generate some sort of random value to prevent conflicting with other scripts or command runs.
It would be useful to be able to set a property from a random value.

Describe the solution you'd like
A random attribute should be added to the <property> element.

<property name="my_random_numeric_id" random="#####" />
<property name="my_random_name" random="Aaaaaaaa" />
<property name="my_random_string" random="zZ" />
<property name="my_random_guid" random="guid" />

where

  • # generates a random numeric digit.
  • a generates a random alphabetic lowercase letter.
  • A generates a random alphabetic uppercase letter.
  • z or Z generates a random alphanumeric character (digits, uppercase and lowercase letters).
  • GUID generates a random GUID.

Additional properties for numeric values should also be considered.
For example attributes such randommin and randommax would allow ranged value generation:

<property name="my_dice_roll" random="#" randommin="1" randommax="6" />
<property name="my_coin_flip" random="#" randommin="0" randommax="1" />
<property name="my_random_card" random="#" randommin="1" randommax="52" />

Describe alternatives you've considered
You could generate random numbers with the following steps:

  • Execute an external script with <exec>.
  • Wait for the execution to complete.
  • Dump the output to a file.
  • Read the file as a property.

However, that would be unnecessary complicated and ugly.

Additional context
N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions