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

random selections not produced for small sets or fast operations #26

Closed
wadeholler opened this issue May 22, 2018 · 2 comments
Closed

Comments

@wadeholler
Copy link
Contributor

Hi there,

Thank you for opening an issue. Please note that we try to keep the Terraform issue tracker reserved for bug reports and feature requests. For general usage questions, please see: https://www.terraform.io/community.html.

Terraform Version

Terraform v0.11.1

  • provider.random v1.3.0

Affected Resource(s)

resource_shuffle or all random resources

Terraform Configuration Files

resource "random_shuffle" "mu_random_subnet" {
  input = ["a", "b", "c"]
  result_count = 1
  count = "10"
}

output "mu_shuffles" {
  value = ["${random_shuffle.mu_random_subnet.*.result}"]
}

Debug Output

...
random_shuffle.mu_random_subnet[2]: Creation complete after 0s (ID: -)
random_shuffle.mu_random_subnet[0]: Creation complete after 0s (ID: -)
random_shuffle.mu_random_subnet[6]: Creation complete after 0s (ID: -)
random_shuffle.mu_random_subnet[9]: Creation complete after 0s (ID: -)
random_shuffle.mu_random_subnet[4]: Creation complete after 0s (ID: -)
random_shuffle.mu_random_subnet[1]: Creation complete after 0s (ID: -)
random_shuffle.mu_random_subnet[7]: Creation complete after 0s (ID: -)
random_shuffle.mu_random_subnet[3]: Creation complete after 0s (ID: -)
random_shuffle.mu_random_subnet[5]: Creation complete after 0s (ID: -)
random_shuffle.mu_random_subnet[8]: Creation complete after 0s (ID: -)

Apply complete! Resources: 10 added, 0 changed, 0 destroyed.

Outputs:

mu_shuffles = [
    [
        a
    ],
    [
        a
    ],
    [
        a
    ],
    [
        a
    ],
    [
        a
    ],
    [
        a
    ],
    [
        a
    ],
    [
        a
    ],
    [
        a
    ],
    [
        a
    ]
]

Expected Behavior

Random results should have been produced

Actual Behavior

This is not random for small or fast operations

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform apply

Suggestion

I have tested using UnixNano() instead of Unix and that fixes it. I will submit a PR

@wadeholler wadeholler changed the title random selections no produced for small sets or fast operations random selections not produced for small sets or fast operations May 22, 2018
@bflad
Copy link
Contributor

bflad commented May 3, 2023

This appears to have been resolved awhile ago in #27 👍

@bflad bflad closed this as completed May 3, 2023
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants