Главная
translate
Войти
Регистрация
Форум
Блоги
Пользователи
Ресурсы
Список джемов
Поиск
Loading...
Login form
Ruby On Rails in UA
/
Code Review, Вопросы по теории программирования
/
Генерация пароля случайным образом
/
RE: Генерация пароля случайным образом
назад
новый
ответить
2008-06-09 12:50:04
Ответить
Ruslan Voloshin
Адрес:
odessa
Сообщений: 1201
Регистр: 2007-03-13
его блог
40 сообщ.
RE: Генерация пароля случайным образом
rand # => 0.517297883846589 rand # => 0.946962603814814 #--- rand(5) # => 0 rand(5) # => 4 rand(5) # => 3 rand(1000) # => 39 #--- a = ['item1', 'item2', 'item3'] a[rand(a.size)] # => "item3" #--- m = { :key1 => 'value1', :key2 => 'value2', :key3 => 'value3' } values = m.values values[rand(values.size)] # => "value1" #--- def random_word letters = { ?v => 'aeiou', ?c => 'bcdfghjklmnprstvwyz' } word = '' 'cvcvcvc'.each_byte do |x| source = letters[x] word << source[rand(source.length)].chr end return word end random_word # => "josuyip" random_word # => "haramic" #--- #Some random numbers based on process number and current time rand(1000) # => 187 rand(1000) # => 551 rand(1000) # => 911 #Start the seed with the number 1 srand 1 rand(1000) # => 37 rand(1000) # => 235 rand(1000) # => 908 #Reset the seed to its previous state srand 1 rand(1000) # => 37 rand(1000) # => 235 rand(1000) # => 908 #---
генерация пароля
,
генерация случайных чисел
назад
новый
ответить
Ключевые слова:
NetBeans [7]
string swapcase [1]
attach file [1]
security rails [1]
validates_uniqueness_of [2]
apache rails cache config [1]
rdt tool eclipse [1]
учебник [1]
запуск [1]
NameError [1]
посещаемость [1]
fckeditor [6]
rails Enum Column in MySql [1]
Gtk [1]
запуск файла [1]
vavlidate email [1]
f.puts [1]
interactiong over dates [1]
delete_all [1]
rails test observer [1]
Гости: 100 Онлайн: 0
О проекте
по всем вопросам обращайтесь на
support
Rubyclub.com.ua
Copyright © 2007 - 2008