Skip to content

Should client use its own source for randomness? #40

@nmiyake

Description

@nmiyake

Currently, the Do function of httpclient.clientImpl uses rand.Intn(len(uris)) to determine the offset that should be used for the URI.

This code uses the global source for randomness, so unless the client application explicitly seeds the global random source, the sequence of offsets that this code chooses will always be the same.

This is not necessarily an issue in and of itself, but does seem somewhat counter-intuitive. Possible approaches:

  • Document that sequence of offsets chosen will be deterministic unless global source of randomness is seeded
  • Store *rand.Rand as part of the client and seed it on construction (and optionally expose a way to disable seeding it/specifying a seed manually if there is a desire to control the sequence)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions