Class: Fixnum
Overview
Some methods of Fixnum
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.
-
#power_with_rgb(other) ⇒ Object
** is modified to work with RGB values.
-
#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 |
#power_with_rgb(other) ⇒ Object
** is modified to work with RGB values
923 924 925 926 927 928 929 930 |
# File 'lib/multiarray/rgb.rb', line 923 def power_with_rgb(other) if other.is_a? Hornetseye::RGB x, y = other.coerce self x ** y else power_without_rgb other end end |
#shl_with_hornetseye(other) ⇒ Object
<< is modified to work with this library
443 444 445 446 447 448 449 450 |
# File 'lib/multiarray.rb', line 443 def shl_with_hornetseye( other ) if other.is_a? Integer shl_without_hornetseye other else x, y = other.coerce self x << y end end |
#shr_with_hornetseye(other) ⇒ Object
>> is modified to work with this library
460 461 462 463 464 465 466 467 |
# File 'lib/multiarray.rb', line 460 def shr_with_hornetseye( other ) if other.is_a? Integer shr_without_hornetseye other else x, y = other.coerce self x >> y end end |