1

I've tried a few methods and this is the closest yet - how can the maths library be called from a jruby script?

require 'java'
require 'commons-math3-3.2.jar'

import org.apache.commons.math3.random.RandomGenerator

myClass = RandomGenerator.new

puts "hello!"

puts myClass.nextBoolean()

The error that is returned is NoMethodError: undefined method `nextBoolean' for #<#:0x7816fcc4>

RedNax
  • 1,507
  • 1
  • 10
  • 20

1 Answers1

3

OK. Got it working.

require 'java'
require 'commons-math3-3.2.jar'

Randy = org.apache.commons.math3.random.RandomDataGenerator 
jp = Randy.new

puts jp.nextInt(10,20)
RedNax
  • 1,507
  • 1
  • 10
  • 20