photoprism/internal/frame/angle.go
Michael Mayer a30cbb19b7 Albums: Regenerate share preview after one hour and after changes #3658
Signed-off-by: Michael Mayer <michael@photoprism.app>
2023-09-08 17:36:56 +02:00

24 lines
289 B
Go

package frame
import (
"math/rand"
)
// RandomAngle returns a random angle between -max and max.
func RandomAngle(max float64) float64 {
if max == 0 {
return 0
}
if max < 0 {
max = -1 * max
}
if max > 180 {
max = 180
}
r := 2 * max
return (rand.Float64() - 0.5) * r
}