Skip to content

Commit 8695cf3

Browse files
authored
Merge pull request #2694 from ethancrawford/fix_doc_examples
Fix doc examples
2 parents 46edd66 + 53cc713 commit 8695cf3

File tree

1 file changed

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

1 file changed

+24
-20
lines changed

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

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3132,14 +3132,16 @@ def rand_look(*args)
31323132
31333133
Does not consume a random value from the stream. Therefore, multiple sequential calls to `rand_look` will all return the same value.",
31343134
examples: ["
3135-
print rand_look(0.5) #=> will print a number like 0.375030517578125 to the output pane",
3135+
print rand_look(0.5) # will print a number like 0.375030517578125 to the output pane",
31363136

31373137
"
3138-
print rand_look(0.5) #=> will print a number like 0.375030517578125 to the output pane
3139-
print rand_look(0.5) #=> will print the same number again
3140-
print rand_look(0.5) #=> will print the same number again
3141-
print rand(0.5) #=> will print a different random number
3142-
print rand_look(0.5) #=> will print the same number as the previous line again."
3138+
print rand_look(0.5) # will print a number like 0.375030517578125 to the output pane
3139+
print rand_look(0.5) # will print the same number again
3140+
print rand_look(0.5) # will print the same number again
3141+
print rand(0.5) # will still print the same number again
3142+
# (this is the number rand_look was 'looking ahead' at)
3143+
# the number is now consumed
3144+
print rand_look(0.5) # will print a new number like 0.3669586181640625 to the output pane"
31433145
]
31443146

31453147

@@ -3160,14 +3162,16 @@ def rand_i_look(*args)
31603162
31613163
Does not consume a random value from the stream. Therefore, multiple sequential calls to `rand_i_look` will all return the same value.",
31623164
examples: ["
3163-
print rand_i_look(5) #=> will print either 0, 1, 2, 3, or 4 to the output pane",
3165+
print rand_i_look(5) # will print either 0, 1, 2, 3, or 4 to the output pane",
31643166

31653167
"
3166-
print rand_i_look(5) #=> will print either 0, 1, 2, 3, or 4 to the output pane
3167-
print rand_i_look(5) #=> will print the same number again
3168-
print rand_i_look(5) #=> will print the same number again
3169-
print rand_i(5) #=> will print either 0, 1, 2, 3, or 4 to the output pane
3170-
print rand_i_look(5) #=> will print the same number as the previous statement"
3168+
print rand_i_look(5) # will print either 0, 1, 2, 3, or 4 to the output pane
3169+
print rand_i_look(5) # will print the same number again
3170+
print rand_i_look(5) # will print the same number again
3171+
print rand_i(5) # will still print the same number again
3172+
# (this is the number rand_i_look was 'looking ahead' at)
3173+
# the number is now consumed
3174+
print rand_i_look(5) # will print either 0, 1, 2, 3, or 4 to the output pane"
31713175
]
31723176

31733177

@@ -3315,9 +3319,9 @@ def use_random_seed(seed, &block)
33153319
## Basic usage
33163320
33173321
use_random_seed 1 # reset random seed to 1
3318-
puts rand # => 0.417022004702574
3322+
puts rand # => 0.733917236328125
33193323
use_random_seed 1 # reset random seed back to 1
3320-
puts rand #=> 0.417022004702574
3324+
puts rand #=> 0.733917236328125
33213325
",
33223326
"
33233327
## Generating melodies
@@ -3372,15 +3376,15 @@ def with_random_seed(seed, &block)
33723376
requires_block: true,
33733377
examples: ["
33743378
use_random_seed 1 # reset random seed to 1
3375-
puts rand # => 0.417022004702574
3376-
puts rand #=> 0.7203244934421581
3379+
puts rand # => 0.733917236328125
3380+
puts rand #=> 0.464202880859375
33773381
use_random_seed 1 # reset it back to 1
3378-
puts rand # => 0.417022004702574
3382+
puts rand # => 0.733917236328125
33793383
with_random_seed 1 do # reset seed back to 1 just for this block
3380-
puts rand # => 0.417022004702574
3381-
puts rand #=> 0.7203244934421581
3384+
puts rand # => 0.733917236328125
3385+
puts rand #=> 0.464202880859375
33823386
end
3383-
puts rand # => 0.7203244934421581
3387+
puts rand # => 0.464202880859375
33843388
# notice how the original generator is restored",
33853389
"
33863390
## Generating melodies

0 commit comments

Comments
 (0)