summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKurt <kurt.w.jung@gmail.com>2019-02-28 10:02:01 -0500
committerKurt <kurt.w.jung@gmail.com>2019-02-28 10:02:01 -0500
commita80b38af5767fdc558bed247f31aa45a0f5150c5 (patch)
tree7186f6ad708b0550cbd300786ded2d3f781ae329
parentbe3a6c4df9df642829ec0a95b43b280c263251e4 (diff)
Use local instance of random number generator so example documents are reproducable
-rw-r--r--fpdf_test.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/fpdf_test.go b/fpdf_test.go
index 3201ef9..707339f 100644
--- a/fpdf_test.go
+++ b/fpdf_test.go
@@ -2387,6 +2387,7 @@ func ExampleFpdf_SubWrite() {
// ExampleFpdf_SetPage demomstrates the SetPage() method, allowing content
// generation to be deferred until all pages have been added.
func ExampleFpdf_SetPage() {
+ rnd := rand.New(rand.NewSource(0)) // Make reproducable documents
pdf := gofpdf.New("L", "cm", "A4", "")
pdf.SetFont("Times", "", 12)
@@ -2400,7 +2401,7 @@ func ExampleFpdf_SetPage() {
for i := 0.0; i < 100; i += 0.5 {
time = append(time, i)
for j, sensor := range temperaturesFromSensors {
- dataValue := rand.Float64() * maxs[j]
+ dataValue := rnd.Float64() * maxs[j]
sensor = append(sensor, dataValue)
temperaturesFromSensors[j] = sensor
}