Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
end2endzone opened this issue Jan 14, 2024 · 2 comments
Closed
Labels
enhancement New feature or request
Milestone

Comments

@end2endzone
Copy link
Owner

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

@end2endzone end2endzone added the enhancement New feature or request label Jan 14, 2024
@end2endzone end2endzone changed the title Set a property value from a random value. Generate random property values. Set a property value from a random value (generate random values). Jan 14, 2024
@end2endzone end2endzone added this to the 0.9.0 milestone Jan 25, 2024
end2endzone added a commit that referenced this issue Jan 30, 2024
…Service. Added new unit test for the new class. Modified code to setup PcgRandomService as a valid IRandomService for the App class. #146
end2endzone added a commit that referenced this issue Feb 1, 2024
end2endzone added a commit that referenced this issue Feb 1, 2024
…alue by 1 to convert from "exclused" to "included" range.

Implementing re/seeding support for IRandomService.h
Created more unit tests. #146
end2endzone added a commit that referenced this issue Feb 2, 2024
…ld generates values bigger than the actual pattern length. #146
end2endzone added a commit that referenced this issue Feb 2, 2024
…ld generates values bigger than the actual pattern length. #146
end2endzone added a commit that referenced this issue Feb 4, 2024
end2endzone added a commit that referenced this issue Feb 4, 2024
@end2endzone
Copy link
Owner Author

Support for <property name="my_random_guid" random="guid" /> was replaced in favor of random.guid live property. See eda0993 for details.

end2endzone added a commit that referenced this issue Feb 4, 2024
* feature-issue146:
  Updated CHANGES for #146
  Updated documentation for `random.guid`, `random.file` and `random.path` live properties. #146
  Implemented `random.guid`, `random.file` and `random.path` live properties. #146
  Updated documentation for `random`, `randommin` and `randommax` attributes #146
  Fixed a bug where using `randommin` without `randommax` attribute would generates values bigger than the actual pattern length. #146
  Fixed a bug in RandomHelper::GetRandomMinMaxValue() to increase max_value by 1 to convert from "exclused" to "included" range. Implementing re/seeding support for IRandomService.h Created more unit tests. #146
  Implemented `random`, `randommin` and `randommax` attributes for ActionProperty elements. #146.
  Created IRandomService interface and a valid implementation PcgRandomService. Added new unit test for the new class. Modified code to setup PcgRandomService as a valid IRandomService for the App class. #146
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant