"use_random_seed" get stuck

Hi all
Wondering why this code get stuck on “126”?
Kind regards
Relaxnow
A.9 - Surfing Random Streams

use_bpm 90

live_loop :tabla do
  #stop
  
  i = rrand_i(1,200)
  puts i
  
  2.times do
    use_random_seed i#200    104  107  40 31
    
    15.times do
      sample  :tabla_tun1, rpitch: (scale :minor_pentatonic).choose, pan: 0.25#+24
      #                                                               #0 5
      sample  :tabla_tun2, rpitch: (scale :minor_pentatonic).choose-12-0, pan: -0.25 if spread(3,5).tick
      sleep 0.25
    end
    sleep 0.25
    
  end
end

well i guess its because u cant radnomize random seeds, you can just infinitly add to it.
how i understand it.
or making a list but this doesnt work randomly either

1 Like

I found two solutions in the forum after digging a bit.

" i= Time.now.to_i"
from More real randomization - #2 by Martin

“i=Random.rand(1…200)”
from More real randomization - #11 by rubertres

use_bpm 90

live_loop :tabla do
  #stop
  
  # Trouble: "i" gets stuck at "126" after some time
  i = rrand_i(1,200)
  
  # Solution 1: Using time as random_seed
  i= Time.now.to_i
  
  # Solution 2: more clear and easier to read + between 1-200
  i=Random.rand(1..200)
  
  puts i
  use_random_seed i
  
  2.times do
    use_random_seed i #200    104  107  40 31
    
    15.times do
      sample  :tabla_tun1, rpitch: (scale :minor_pentatonic).choose, pan: 0.25#+24
      #                                                               #0 5
      sample  :tabla_tun2, rpitch: (scale :minor_pentatonic).choose-12-0, pan: -0.25 if spread(3,5).tick
      sleep 0.25
    end
    sleep 0.25
    
  end
  
end
2 Likes

wow genius thanks man