@@ -34,13 +34,13 @@ func ExampleH1D() {
3434 dist := distuv.Normal {
3535 Mu: 0 ,
3636 Sigma: 1 ,
37- Src: rand.New (rand.NewSource ( 0 )),
37+ Src: rand.New (rand.NewPCG ( 0 , 0 )),
3838 }
3939
4040 // Draw some random values from the standard
4141 // normal distribution.
4242 hist := hbook.NewH1D (20 , -4 , +4 )
43- for i := 0 ; i < npoints; i++ {
43+ for range npoints {
4444 v := dist.Rand ()
4545 hist.Fill (v, 1 )
4646 }
@@ -93,13 +93,13 @@ func ExampleH1D_withYErrBars() {
9393 dist := distuv.Normal {
9494 Mu: 0 ,
9595 Sigma: 1 ,
96- Src: rand.New (rand.NewSource ( 0 )),
96+ Src: rand.New (rand.NewPCG ( 0 , 0 )),
9797 }
9898
9999 // Draw some random values from the standard
100100 // normal distribution.
101101 hist := hbook.NewH1D (20 , -4 , +4 )
102- for i := 0 ; i < npoints; i++ {
102+ for range npoints {
103103 v := dist.Rand ()
104104 hist.Fill (v, 1 )
105105 }
@@ -155,13 +155,13 @@ func ExampleH1D_withYErrBarsAndData() {
155155 dist := distuv.Normal {
156156 Mu: 0 ,
157157 Sigma: 1 ,
158- Src: rand.New (rand.NewSource ( 0 )),
158+ Src: rand.New (rand.NewPCG ( 0 , 0 )),
159159 }
160160
161161 // Draw some random values from the standard
162162 // normal distribution.
163163 hist := hbook.NewH1D (20 , -4 , +4 )
164- for i := 0 ; i < npoints; i++ {
164+ for range npoints {
165165 v := dist.Rand ()
166166 hist.Fill (v, 1 )
167167 }
@@ -229,13 +229,13 @@ func ExampleH1D_withYErrBars_withBand() {
229229 dist := distuv.Normal {
230230 Mu: 0 ,
231231 Sigma: 1 ,
232- Src: rand.New (rand.NewSource ( 0 )),
232+ Src: rand.New (rand.NewPCG ( 0 , 0 )),
233233 }
234234
235235 // Draw some random values from the standard
236236 // normal distribution.
237237 hist := hbook.NewH1D (20 , -4 , +4 )
238- for i := 0 ; i < npoints; i++ {
238+ for range npoints {
239239 v := dist.Rand ()
240240 hist.Fill (v, 1 )
241241 }
@@ -292,13 +292,13 @@ func ExampleTiledPlot() {
292292 dist := distuv.Normal {
293293 Mu: 0 ,
294294 Sigma: 1 ,
295- Src: rand.New (rand.NewSource ( 0 )),
295+ Src: rand.New (rand.NewPCG ( 0 , 0 )),
296296 }
297297
298298 newHist := func (p *hplot.Plot ) {
299299 const npoints = 10000
300300 hist := hbook.NewH1D (20 , -4 , +4 )
301- for i := 0 ; i < npoints; i++ {
301+ for range npoints {
302302 v := dist.Rand ()
303303 hist.Fill (v, 1 )
304304 }
@@ -307,8 +307,8 @@ func ExampleTiledPlot() {
307307 p.Add (h)
308308 }
309309
310- for i := 0 ; i < tp.Tiles .Rows ; i++ {
311- for j := 0 ; j < tp.Tiles .Cols ; j++ {
310+ for i := range tp.Tiles .Rows {
311+ for j := range tp.Tiles .Cols {
312312 p := tp.Plot (j, i)
313313 p.X .Min = -5
314314 p.X .Max = +5
@@ -344,7 +344,7 @@ func ExampleTiledPlot_align() {
344344 j = int (math.Pow (10 , float64 (n)))
345345
346346 var pts []hbook.Point2D
347- for ii := 0 ; ii < 10 ; ii++ {
347+ for ii := range 10 {
348348 pts = append (pts, hbook.Point2D {
349349 X: float64 (i + ii),
350350 Y: float64 (j + ii + 1 ),
@@ -354,8 +354,8 @@ func ExampleTiledPlot_align() {
354354
355355 }
356356
357- for i := 0 ; i < tp.Tiles .Rows ; i++ {
358- for j := 0 ; j < tp.Tiles .Cols ; j++ {
357+ for i := range tp.Tiles .Rows {
358+ for j := range tp.Tiles .Cols {
359359 p := tp.Plot (j, i)
360360 p.X .Min = -5
361361 p.X .Max = +5
@@ -398,13 +398,13 @@ func ExampleRatioPlot() {
398398 dist := distuv.Normal {
399399 Mu: 0 ,
400400 Sigma: 1 ,
401- Src: rand.New (rand.NewSource ( 0 )),
401+ Src: rand.New (rand.NewPCG ( 0 , 0 )),
402402 }
403403
404404 hist1 := hbook.NewH1D (20 , -4 , +4 )
405405 hist2 := hbook.NewH1D (20 , -4 , +4 )
406406
407- for i := 0 ; i < npoints; i++ {
407+ for range npoints {
408408 v1 := dist.Rand () - 0.5
409409 v2 := dist.Rand () + 0.5
410410 hist1.Fill (v1, 1 )
@@ -431,7 +431,7 @@ func ExampleRatioPlot() {
431431 rp.Top .Add (hplot.NewGrid ())
432432
433433 hist3 := hbook.NewH1D (20 , -4 , +4 )
434- for i := 0 ; i < hist3.Len (); i++ {
434+ for i := range hist3.Len () {
435435 v1 := hist1.Value (i)
436436 v2 := hist2.Value (i)
437437 x1 , _ := hist1.XY (i)
@@ -475,7 +475,7 @@ func ExampleH2D() {
475475 dist , ok := distmv.NewNormal (
476476 []float64 {0 , 1 },
477477 mat.NewSymDense (2 , []float64 {4 , 0 , 0 , 2 }),
478- rand.New (rand.NewSource ( 1234 )),
478+ rand.New (rand.NewPCG ( 1234 , 1234 )),
479479 )
480480 if !ok {
481481 log.Fatalf (" error creating distmv.Normal" )
@@ -484,7 +484,7 @@ func ExampleH2D() {
484484 v := make ([]float64 , 2 )
485485 // Draw some random values from the standard
486486 // normal distribution.
487- for i := 0 ; i < npoints; i++ {
487+ for range npoints {
488488 v = dist.Rand (v)
489489 h.Fill (v[0 ], v[1 ], 1 )
490490 }
@@ -514,7 +514,7 @@ func ExampleS2D() {
514514 dist , ok := distmv.NewNormal (
515515 []float64 {0 , 1 },
516516 mat.NewSymDense (2 , []float64 {4 , 0 , 0 , 2 }),
517- rand.New (rand.NewSource ( 1234 )),
517+ rand.New (rand.NewPCG ( 1234 , 1234 )),
518518 )
519519 if !ok {
520520 log.Fatalf (" error creating distmv.Normal" )
@@ -525,7 +525,7 @@ func ExampleS2D() {
525525 v := make ([]float64 , 2 )
526526 // Draw some random values from the standard
527527 // normal distribution.
528- for i := 0 ; i < npoints; i++ {
528+ for range npoints {
529529 v = dist.Rand (v)
530530 s2d.Fill (hbook.Point2D {X: v[0 ], Y: v[1 ]})
531531 }
@@ -630,15 +630,15 @@ func ExampleBand() {
630630 dist := distuv.Normal {
631631 Mu: 0 ,
632632 Sigma: 1 ,
633- Src: rand.New (rand.NewSource ( 0 )),
633+ Src: rand.New (rand.NewPCG ( 0 , 0 )),
634634 }
635635
636636 topData := make (plotter.XYs , npoints)
637637 botData := make (plotter.XYs , npoints)
638638
639639 // Draw some random values from the standard
640640 // normal distribution.
641- for i := 0 ; i < npoints; i++ {
641+ for i := range npoints {
642642 x := float64 (i+1 ) / xmax
643643
644644 v1 := dist.Rand ()
@@ -705,13 +705,13 @@ func ExampleH1D_withPlotBorders() {
705705 dist := distuv.Normal {
706706 Mu: 0 ,
707707 Sigma: 1 ,
708- Src: rand.New (rand.NewSource ( 0 )),
708+ Src: rand.New (rand.NewPCG ( 0 , 0 )),
709709 }
710710
711711 // Draw some random values from the standard
712712 // normal distribution.
713713 hist := hbook.NewH1D (20 , -4 , +4 )
714- for i := 0 ; i < npoints; i++ {
714+ for range npoints {
715715 v := dist.Rand ()
716716 hist.Fill (v, 1 )
717717 }
0 commit comments