File: testrandom.rb

package info (click to toggle)
libnarray-ruby 0.5.9p7-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 432 kB
  • ctags: 517
  • sloc: ansic: 4,412; ruby: 1,281; python: 91; makefile: 5
file content (23 lines) | stat: -rw-r--r-- 354 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
require 'narray'

def test a
  print a," #=> "
  p eval(a)
  print "\n"
end

test "NArray.float(5).random(10)"

test "NArray.float(5).random"

test "NArray.int(5).random(10)"

test "NArray.int(1000).random(10)"

a = NArray.int(1000).random(10)

idx = (a.eq 0).where
print "a.eq 0  :: n=", idx.size, "\n"

idx = (a.eq 10).where
print "a.eq 10 :: "; p idx