Skip to content

Commit edf3246

Browse files
ethancrawfordsamaaron
authored andcommitted
Docs - fix use_/with_random_seed examples
Previously, when the random number stream was updated, these examples were not also updated to reflect the change. Fixes #2690
1 parent a7aafa8 commit edf3246

File tree

1 file changed

+8
-8
lines changed
  • app/server/ruby/lib/sonicpi/lang

1 file changed

+8
-8
lines changed

app/server/ruby/lib/sonicpi/lang/core.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3315,9 +3315,9 @@ def use_random_seed(seed, &block)
33153315
## Basic usage
33163316
33173317
use_random_seed 1 # reset random seed to 1
3318-
puts rand # => 0.417022004702574
3318+
puts rand # => 0.733917236328125
33193319
use_random_seed 1 # reset random seed back to 1
3320-
puts rand #=> 0.417022004702574
3320+
puts rand #=> 0.733917236328125
33213321
",
33223322
"
33233323
## Generating melodies
@@ -3372,15 +3372,15 @@ def with_random_seed(seed, &block)
33723372
requires_block: true,
33733373
examples: ["
33743374
use_random_seed 1 # reset random seed to 1
3375-
puts rand # => 0.417022004702574
3376-
puts rand #=> 0.7203244934421581
3375+
puts rand # => 0.733917236328125
3376+
puts rand #=> 0.464202880859375
33773377
use_random_seed 1 # reset it back to 1
3378-
puts rand # => 0.417022004702574
3378+
puts rand # => 0.733917236328125
33793379
with_random_seed 1 do # reset seed back to 1 just for this block
3380-
puts rand # => 0.417022004702574
3381-
puts rand #=> 0.7203244934421581
3380+
puts rand # => 0.733917236328125
3381+
puts rand #=> 0.464202880859375
33823382
end
3383-
puts rand # => 0.7203244934421581
3383+
puts rand # => 0.464202880859375
33843384
# notice how the original generator is restored",
33853385
"
33863386
## Generating melodies

0 commit comments

Comments
 (0)