Class: Integer
Overview
Some methods of Integer
are modified
Instance Method Summary collapse
-
#drand ⇒ Float
Generate random number.
-
#intand_with_hornetseye(other) ⇒ Object
& is modified to work with this library.
-
#intor_with_hornetseye(other) ⇒ Object
| is modified to work with this library.
-
#intxor_with_hornetseye(other) ⇒ Object
^ is modified to work with this library.
-
#lrand ⇒ Integer
Generate random number.
-
#power_with_hornetseye(other) ⇒ Object
** is modified to work with this library.
-
#shl_with_hornetseye(other) ⇒ Object
<< is modified to work with this library.
-
#shr_with_hornetseye(other) ⇒ Object
>> is modified to work with this library.
Instance Method Details
#drand ⇒ Float
Generate random number
Generate a random number greater or equal to zero and lower than this number.
506 507 508 |
# File 'lib/multiarray.rb', line 506 def drand self * Kernel.rand end |
#intand_with_hornetseye(other) ⇒ Object
& is modified to work with this library
392 393 394 395 396 397 398 399 |
# File 'lib/multiarray.rb', line 392 def intand_with_hornetseye( other ) if other.is_a? Integer intand_without_hornetseye other else x, y = other.coerce self x & y end end |
#intor_with_hornetseye(other) ⇒ Object
| is modified to work with this library
409 410 411 412 413 414 415 416 |
# File 'lib/multiarray.rb', line 409 def intor_with_hornetseye( other ) if other.is_a? Integer intor_without_hornetseye other else x, y = other.coerce self x | y end end |
#intxor_with_hornetseye(other) ⇒ Object
^ is modified to work with this library
426 427 428 429 430 431 432 433 |
# File 'lib/multiarray.rb', line 426 def intxor_with_hornetseye( other ) if other.is_a? Integer intxor_without_hornetseye other else x, y = other.coerce self x ^ y end end |
#lrand ⇒ Integer
Generate random number
Generate a random number greater or equal to zero and lower than this number.
497 498 499 |
# File 'lib/multiarray.rb', line 497 def lrand Kernel.rand self end |
#power_with_hornetseye(other) ⇒ Object
** is modified to work with this library
479 480 481 482 483 484 485 486 |
# File 'lib/multiarray.rb', line 479 def power_with_hornetseye( other ) if other.matched? x, y = other.coerce self x ** y else power_without_hornetseye other end end |