Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Kernel's methods example #11

Open
samnang opened this issue Oct 5, 2011 · 3 comments
Open

Improve Kernel's methods example #11

samnang opened this issue Oct 5, 2011 · 3 comments

Comments

@samnang
Copy link
Member

samnang commented Oct 5, 2011

I will go through some methods that I understand and add/update more examples on those methods.

Ex:

Improve on Array() method's example:

Array(1..3)     #=> [1, 2, 3]
Array([1, 2])   #=> [1, 2]
Array(1)        #=> [1]
Array(nil)      #=> []

Improve on srand() method:

#  Seeds the pseudorandom number generator to the value of
#  <i>number</i>. If <i>number</i> is omitted,
#  seeds the generator using a combination of the time, the
#  process id, and a sequence number. (This is also the behavior if
#  <code>Kernel::rand</code> is called without previously calling
#  <code>srand</code>, but without the sequence.) By setting the seed
#  to a known value, scripts can be made deterministic during testing, and
#  even in different applications sequence of generated randoms numbers 
#  are the same. The previous seed value is returned.
#  Also see <code>Kernel::rand</code>.
#
#      srand(2011)
#      rand(100)  #=> 43
#      rand(100)  #=> 77
#      rand(100)  #=> 40
#
#      srand(2011)
#      rand(100)  #=> 43
#      rand(100)  #=> 77
#      rand(100)  #=> 40
@madebydna
Copy link

Hi Samnang,

I'm already working on stuff in the Array class and will also improve some of the method description like for example the different ways of initializing an Array.

Just wanted to let you know so that we don't duplicate efforts.

~ Andrea

@samnang
Copy link
Member Author

samnang commented Oct 6, 2011

Hi Andrea,

I only add some examples of using that method, and I don't include more description or other ways of how to instantiate an object of Array class, so it will be fine.

Samnang

@madebydna
Copy link

Ok, Samnang. No problem. Just wanted to make sure.

~ Andrea

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants