Skip to content
This repository has been archived by the owner on Jun 13, 2021. It is now read-only.

Add a seed for better randomness #741

Merged
merged 2 commits into from
Nov 14, 2019
Merged

Add a seed for better randomness #741

merged 2 commits into from
Nov 14, 2019

Conversation

rumpl
Copy link
Member

@rumpl rumpl commented Nov 13, 2019

- What I did

Added a call to rand.Seed

Without the seed the rand.Intn will always start from the same place and
return the same application name

- How to verify it

Without this change run:

$ docker app run APP1
$ docker app run APP2

The second one would fail with a message: Installation "gallant_poitras" already exists, use 'docker app update' instead

- A picture of a cute animal (not mandatory)
image

Without the seed the rand.Intn will always start from the same place and
return the same application name

Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
@justincormack
Copy link
Member

Please do not use math/rand in any code, just use crypto/rand

@rumpl
Copy link
Member Author

rumpl commented Nov 13, 2019

Please do not use math/rand in any code, just use crypto/rand

The call to rand.Intn is in moby

@rumpl
Copy link
Member Author

rumpl commented Nov 13, 2019

This is for random name generation

@justincormack
Copy link
Member

Hmm, I thought I had fixed that one too, ok will change it there.

@codecov
Copy link

codecov bot commented Nov 13, 2019

Codecov Report

Merging #741 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #741   +/-   ##
=======================================
  Coverage   68.98%   68.98%           
=======================================
  Files          64       64           
  Lines        3437     3437           
=======================================
  Hits         2371     2371           
  Misses        748      748           
  Partials      318      318

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 61e61a8...2aacb5d. Read the comment docs.

@justincormack
Copy link
Member

Its ok to merge this though, before I change the implementation.

Copy link
Contributor

@silvin-lubecki silvin-lubecki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@rumpl rumpl merged commit aaa673f into docker:master Nov 14, 2019
@rumpl rumpl deleted the random-seed branch November 14, 2019 12:21
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants