Get current random source

current_random_source  

Returns the source of the current random number generator (what kind of noise is generating the random numbers).

This can be set via the fns use_random_source and with_random_source. Each source will provide a different pattern of random numbers.

Introduced in v4.0

Examples

# Example 1

puts current_random_source



# Print out the current random source



# Example 2

use_random_source :white
puts rand
puts rand
a = current_random_source
use_random_source :perlin
puts rand
puts rand
use_random_source a
                   
puts rand
puts rand



# Use white noise as the distribution (default)
# => 0.75006103515625
# => 0.733917236328125
# Grab the current random number source (:white)
# Use perlin noise as the distribution
# => 0.58526611328125
# => 0.597015380859375
# Restore the previous random number source (:white)
# The numbers will again be generated from a white noise distribution
# => 0.10821533203125
# => 0.54010009765625