summaryrefslogtreecommitdiff
path: root/lib/trocla/util.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/trocla/util.rb')
-rw-r--r--lib/trocla/util.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/trocla/util.rb b/lib/trocla/util.rb
index 3461bb2..2b1c6c6 100644
--- a/lib/trocla/util.rb
+++ b/lib/trocla/util.rb
@@ -1,12 +1,13 @@
+require 'securerandom'
class Trocla
class Util
class << self
def random_str(length=12)
- (1..length).collect{|a| chars[rand(chars.size)] }.join.to_s
+ (1..length).collect{|a| chars[SecureRandom.random_number(chars.size)] }.join.to_s
end
def salt(length=8)
- (1..length).collect{|a| normal_chars[rand(normal_chars.size)] }.join.to_s
+ (1..length).collect{|a| normal_chars[SecureRandom.random_number(normal_chars.size)] }.join.to_s
end
private