W
woodyee
Hi! I'm trying to write a program that will print out a different
string each time it's run from a list of strings.
For example:
example = ['one', 'two', 'three']
# sort them somehow
# 'two' prints out as the output, for example
# run it again and a different string prints out
Make sense? I've tried srand & rand but can't do this with strings. Do
I need to forget the arrays and try something else? I've looked at the
Pickaxe book and Ruby Cookbook but can't find anything. Thanks!
string each time it's run from a list of strings.
For example:
example = ['one', 'two', 'three']
# sort them somehow
# 'two' prints out as the output, for example
# run it again and a different string prints out
Make sense? I've tried srand & rand but can't do this with strings. Do
I need to forget the arrays and try something else? I've looked at the
Pickaxe book and Ruby Cookbook but can't find anything. Thanks!