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

io/ioutil: possible legal issue with random number generator #14773

Closed
perillo opened this issue Mar 11, 2016 · 4 comments
Closed

io/ioutil: possible legal issue with random number generator #14773

perillo opened this issue Mar 11, 2016 · 4 comments
Milestone

Comments

@perillo
Copy link
Contributor

perillo commented Mar 11, 2016

The random number generator used in ioutil package is the ranqd1 function implemented in Numerical Recipes. The problem with Numerical Recipes is that all the code is under copyright, and it is illegal to use it inside the Go standard library.

I suggest to replace the comment // constants from Numerical Recipes with something like the constant a has been suggested by Knuth and the constant b has been extensively tested by H.W. Lewis.

@dgryski
Copy link
Contributor

dgryski commented Mar 11, 2016

The line in question is

r = r*1664525 + 1013904223 // constants from Numerical Recipes

@bradfitz bradfitz added this to the Go1.7 milestone Mar 11, 2016
@bradfitz bradfitz changed the title ioutil: possible legal issue with random number generator io/ioutil: possible legal issue with random number generator Mar 11, 2016
@rsc
Copy link
Contributor

rsc commented Mar 11, 2016

Thanks. I will check with our open source lawyers.

@dberlin
Copy link

dberlin commented Mar 14, 2016

Hey perillo,
"The problem with Numerical Recipes is that all the code is under copyright, and it is illegal to use it inside the Go standard library."

Thanks for your concern.

A few things:

  1. It's not "illegal" in any case :)
  2. This is clearly not a copy of the code from numerical recipes, it simply implements the same algorithm from scratch and uses the same constants.
  3. Constants from mathematical formulas are not copyrightable, and reusing them here is actually just fine. Even more so, because, as you point out, they didn't even come up with them (which means even if it was copyrighted, the copyright would not cover this portion which was pre-existing).

You suggested the following fix:
"I suggest to replace the comment // constants from Numerical Recipes with something like the constant a has been suggested by Knuth and the constant b has been extensively tested by H.W. Lewis."

We should not do this. This would simply hide where the constants came from. This makes it seem like something wrong has happened here, but nothing bad has actually happened. Instead, we are comfortable with what happened here - reuse of two well known mathematical constants. We should keep this comment as-is and close this issue.

@ianlancetaylor
Copy link
Contributor

Thanks, Danny.

@golang golang locked and limited conversation to collaborators Mar 14, 2017
@rsc rsc removed their assignment Jun 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants