Skip to content

Commit

Permalink
Merge branch 'master' of github.com:bit101/bitlib
Browse files Browse the repository at this point in the history
  • Loading branch information
bit101 committed Dec 11, 2023
2 parents 05a256e + 8adc2b4 commit 4f2f86b
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 4 deletions.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Keith Peters

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
2 changes: 1 addition & 1 deletion geom/point.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func RandomPointInRect(x, y, w, h float64) *Point {
}

// RandomPointInCircle creates a random point within the defined circle.
// if dist is true, it will evenly distrubute them in the circle.
// if dist is true, it will evenly distribute them in the circle.
func RandomPointInCircle(x, y, r float64, dist bool) *Point {
var radius float64
angle := random.FloatRange(0, math.Pi*2)
Expand Down
2 changes: 1 addition & 1 deletion noise/simplex.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ func Simplex1(x float64) float64 {
// The maximum value of this noise is 8*(3/4)^4 = 2.53125
// A factor of 0.395 would scale to fit exactly within [-1,1].
// fmt.Printf("Noise1 x %.4f, i0 %v, i1 %v, x0 %.4f, x1 %.4f, perm0 %d, perm1 %d: %.4f,%.4f\n", x, i0, i1, x0, x1, perm[i0&0xff], perm[i1&0xff], n0, n1)
// The algorithm isn't perfect, as it is assymetric. The correction will normalize the result to the interval [-1,1], but the average will be off by 3%.
// The algorithm isn't perfect, as it is asymmetric. The correction will normalize the result to the interval [-1,1], but the average will be off by 3%.
return (n0 + n1 + 0.076368899) / 2.45488110001
}

Expand Down
4 changes: 2 additions & 2 deletions random/random.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func GaussRange(min, max float64) float64 {
return rng.GaussRange(min, max)
}

// Norm returns a random number within a normal distrubution with the given mean and standard deviation.
// Norm returns a random number within a normal distribution with the given mean and standard deviation.
func Norm(mean, std float64) float64 {
return rng.Norm(mean, std)
}
Expand Down Expand Up @@ -218,7 +218,7 @@ func (r *Random) GaussRange(min, max float64) float64 {
return r.Norm(mean, std)
}

// Norm returns a random number within a normal distrubution with the given mean and standard deviation.
// Norm returns a random number within a normal distribution with the given mean and standard deviation.
func (r *Random) Norm(mean, std float64) float64 {
return r.rng.NormFloat64()*std + mean
}
Expand Down

0 comments on commit 4f2f86b

Please sign in to comment.