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.
514 515 516 |
# File 'lib/multiarray.rb', line 514 def drand self * Kernel.rand end |
#intand_with_hornetseye(other) ⇒ Object
& is modified to work with this library
400 401 402 403 404 405 406 407 |
# File 'lib/multiarray.rb', line 400 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
417 418 419 420 421 422 423 424 |
# File 'lib/multiarray.rb', line 417 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
434 435 436 437 438 439 440 441 |
# File 'lib/multiarray.rb', line 434 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.
505 506 507 |
# File 'lib/multiarray.rb', line 505 def lrand Kernel.rand self end |
#power_with_hornetseye(other) ⇒ Object
** is modified to work with this library
487 488 489 490 491 492 493 494 |
# File 'lib/multiarray.rb', line 487 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
451 452 453 454 455 456 457 458 |
# File 'lib/multiarray.rb', line 451 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
468 469 470 471 472 473 474 475 |
# File 'lib/multiarray.rb', line 468 def shr_with_hornetseye( other ) if other.is_a? Integer shr_without_hornetseye other else x, y = other.coerce self x >> y end end |