redshift 1.3.26 → 1.3.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/RELEASE-NOTES +6 -0
- data/Rakefile +26 -0
- data/lib/redshift/redshift.rb +1 -1
- data/lib/redshift/util/isaac.rb +2 -2
- data/test/test_buffer.rb +2 -2
- data/test/test_connect.rb +2 -2
- data/test/test_connect_parallel.rb +2 -2
- data/test/test_connect_strict.rb +4 -5
- data/test/test_constant.rb +2 -4
- data/test/test_delay.rb +2 -2
- data/test/test_derivative.rb +2 -2
- data/test/test_discrete.rb +2 -4
- data/test/test_discrete_isolated.rb +2 -4
- data/test/test_dvector-float.rb +14 -17
- data/test/test_dvector.rb +15 -17
- data/test/test_exit.rb +2 -4
- data/test/test_flow.rb +2 -4
- data/test/test_flow_link.rb +2 -4
- data/test/test_flow_sub.rb +2 -4
- data/test/test_flow_trans.rb +2 -4
- data/test/test_inherit.rb +2 -4
- data/test/test_inherit_event.rb +2 -4
- data/test/test_inherit_flow.rb +2 -4
- data/test/test_inherit_link.rb +2 -4
- data/test/test_inherit_setup.rb +2 -4
- data/test/test_inherit_state.rb +2 -4
- data/test/test_inherit_transition.rb +2 -4
- data/test/test_numerics.rb +2 -4
- data/test/test_queue.rb +3 -3
- data/test/test_queue_alone.rb +2 -2
- data/test/test_reset.rb +2 -4
- data/test/test_setup.rb +2 -4
- data/test/test_strict_continuity.rb +2 -4
- data/test/test_strict_reset_error.rb +2 -4
- data/test/test_strictness_error.rb +2 -4
- data/test/test_sync.rb +2 -2
- data/test/test_world.rb +2 -4
- metadata +49 -8
- data/ext/redshift/util/isaac/extconf.rb +0 -2
- data/ext/redshift/util/isaac/isaac.c +0 -129
- data/ext/redshift/util/isaac/rand.c +0 -140
- data/ext/redshift/util/isaac/rand.h +0 -61
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f9ca8372d265e9b730e14c976f1765a906181e2b
|
4
|
+
data.tar.gz: d7b22f9a9286357acad7ab342ad5ff8d446ad3bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3150e6a90aea209e06408c12c8c4b5ae400d94737289a294e16c439c26c20dc72defba138b4a3cdc9b2eb21aee7046de82bd2bd281bc0049ea412265f3f58be0
|
7
|
+
data.tar.gz: 88b2d5634395f0423f6464398206ad235749b472f6e3a1c0396bcfc3d2a48892fde88adcddf5d7a2a681264accd3d2426ecea486f57064d5d6411ebd82c89118
|
data/RELEASE-NOTES
CHANGED
data/Rakefile
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'rake'
|
2
|
+
|
3
|
+
def cur_ruby
|
4
|
+
require 'rbconfig'
|
5
|
+
@cur_ruby ||= RbConfig::CONFIG["RUBY_INSTALL_NAME"]
|
6
|
+
end
|
7
|
+
|
8
|
+
desc "Run unit tests"
|
9
|
+
task :test do |t|
|
10
|
+
sh "cd test && RUBYLIB=../lib:../ext:$RUBYLIB ./test.rb"
|
11
|
+
end
|
12
|
+
|
13
|
+
desc "build extensions for current ruby: #{RUBY_VERSION}"
|
14
|
+
task :build_ext do
|
15
|
+
require 'find'
|
16
|
+
Find.find('ext/redshift') do |f|
|
17
|
+
next unless File.basename(f) == "extconf.rb"
|
18
|
+
d = File.dirname(f)
|
19
|
+
Dir.chdir d do
|
20
|
+
sh "make distclean || true"
|
21
|
+
ruby "extconf.rb"
|
22
|
+
sh "make"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
data/lib/redshift/redshift.rb
CHANGED
data/lib/redshift/util/isaac.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
require '
|
1
|
+
require 'isaac'
|
2
2
|
|
3
3
|
# Adaptor class to use ISAAC with redshift/util/random distributions.
|
4
4
|
# See test/test_flow_trans.rb for an example.
|
5
|
-
class ISAACGenerator < ISAAC
|
5
|
+
class ISAACGenerator < PRNG::ISAAC
|
6
6
|
def initialize(*seeds)
|
7
7
|
super()
|
8
8
|
if seeds.compact.empty?
|
data/test/test_buffer.rb
CHANGED
data/test/test_connect.rb
CHANGED
data/test/test_connect_strict.rb
CHANGED
@@ -56,9 +56,9 @@ end
|
|
56
56
|
|
57
57
|
#-----#
|
58
58
|
|
59
|
-
require '
|
59
|
+
require 'minitest/autorun'
|
60
60
|
|
61
|
-
class TestConnectStrict < Test
|
61
|
+
class TestConnectStrict < Minitest::Test
|
62
62
|
|
63
63
|
def setup
|
64
64
|
@world = SCWorld.new
|
@@ -114,9 +114,8 @@ class TestConnectStrict < Test::Unit::TestCase
|
|
114
114
|
a.x = a.k = 12.34
|
115
115
|
end
|
116
116
|
@b.port(:y) << a.port(:x)
|
117
|
-
assert_nothing_raised
|
118
|
-
|
119
|
-
end
|
117
|
+
#assert_nothing_raised
|
118
|
+
@b.port(:y) << a.port(:k)
|
120
119
|
end
|
121
120
|
|
122
121
|
# One check per step, despite the Dummy
|
data/test/test_constant.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
1
|
require 'redshift'
|
4
2
|
|
5
3
|
include RedShift
|
@@ -41,9 +39,9 @@ end
|
|
41
39
|
|
42
40
|
#-----#
|
43
41
|
|
44
|
-
require '
|
42
|
+
require 'minitest/autorun'
|
45
43
|
|
46
|
-
class TestConstant < Test
|
44
|
+
class TestConstant < Minitest::Test
|
47
45
|
|
48
46
|
def setup
|
49
47
|
@world = World.new
|
data/test/test_delay.rb
CHANGED
data/test/test_derivative.rb
CHANGED
data/test/test_discrete.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
1
|
require 'redshift'
|
4
2
|
|
5
3
|
include RedShift
|
@@ -561,9 +559,9 @@ test guard phases
|
|
561
559
|
|
562
560
|
#-----#
|
563
561
|
|
564
|
-
require '
|
562
|
+
require 'minitest/autorun'
|
565
563
|
|
566
|
-
class TestDiscrete < Test
|
564
|
+
class TestDiscrete < Minitest::Test
|
567
565
|
|
568
566
|
def setup
|
569
567
|
@world = World.new
|
@@ -1,5 +1,3 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
1
|
require 'redshift'
|
4
2
|
|
5
3
|
include RedShift
|
@@ -60,9 +58,9 @@ end
|
|
60
58
|
|
61
59
|
#-----#
|
62
60
|
|
63
|
-
require '
|
61
|
+
require 'minitest/autorun'
|
64
62
|
|
65
|
-
class TestDiscrete < Test
|
63
|
+
class TestDiscrete < Minitest::Test
|
66
64
|
|
67
65
|
def setup
|
68
66
|
@world = World.new
|
data/test/test_dvector-float.rb
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
require 'redshift/dvector-float/dvector-float'
|
2
|
-
require '
|
2
|
+
require 'minitest/autorun'
|
3
3
|
|
4
4
|
DVectorFloat = RedShift::DVectorFloat
|
5
5
|
|
6
|
-
class TestDVectorFloat < Test
|
6
|
+
class TestDVectorFloat < Minitest::Test
|
7
7
|
def make_dvs n
|
8
|
-
assert_nothing_thrown do
|
9
|
-
|
10
|
-
|
11
|
-
end
|
8
|
+
#assert_nothing_thrown do
|
9
|
+
n.times do
|
10
|
+
DVectorFloat.new
|
12
11
|
end
|
13
12
|
end
|
14
13
|
|
@@ -16,9 +15,8 @@ class TestDVectorFloat < Test::Unit::TestCase
|
|
16
15
|
GC.start
|
17
16
|
n = ObjectSpace.each_object(DVectorFloat){}
|
18
17
|
|
19
|
-
assert_nothing_thrown
|
20
|
-
|
21
|
-
end
|
18
|
+
#assert_nothing_thrown
|
19
|
+
make_dvs 100
|
22
20
|
|
23
21
|
GC.start
|
24
22
|
n2 = ObjectSpace.each_object(DVectorFloat){}
|
@@ -28,20 +26,19 @@ class TestDVectorFloat < Test::Unit::TestCase
|
|
28
26
|
|
29
27
|
def test_gc_stress
|
30
28
|
GC.stress = true
|
31
|
-
assert_nothing_thrown
|
32
|
-
|
33
|
-
end
|
29
|
+
#assert_nothing_thrown
|
30
|
+
make_dvs 10
|
34
31
|
ensure
|
35
32
|
GC.stress = false
|
36
33
|
end
|
37
34
|
|
38
35
|
def test_push_pop
|
39
36
|
dv = DVectorFloat.new
|
40
|
-
assert_nothing_thrown
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
37
|
+
#assert_nothing_thrown
|
38
|
+
dv.push(1)
|
39
|
+
dv.push(2.567)
|
40
|
+
dv.push(3)
|
41
|
+
|
45
42
|
assert_equal(3, dv.pop)
|
46
43
|
assert_in_delta(2.567, dv.pop, 0.01)
|
47
44
|
assert_equal(1, dv.pop)
|
data/test/test_dvector.rb
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
require 'redshift/dvector/dvector'
|
2
|
-
require '
|
2
|
+
require 'minitest/autorun'
|
3
3
|
|
4
4
|
DVector = RedShift::DVector
|
5
5
|
|
6
|
-
class TestDVector < Test
|
6
|
+
class TestDVector < Minitest::Test
|
7
7
|
def make_dvs n
|
8
|
-
assert_nothing_thrown
|
9
|
-
|
10
|
-
|
11
|
-
end
|
8
|
+
#assert_nothing_thrown
|
9
|
+
n.times do
|
10
|
+
DVector.new
|
12
11
|
end
|
13
12
|
end
|
14
13
|
|
@@ -16,9 +15,8 @@ class TestDVector < Test::Unit::TestCase
|
|
16
15
|
GC.start
|
17
16
|
n = ObjectSpace.each_object(DVector){}
|
18
17
|
|
19
|
-
assert_nothing_thrown
|
20
|
-
|
21
|
-
end
|
18
|
+
#assert_nothing_thrown
|
19
|
+
make_dvs 100
|
22
20
|
|
23
21
|
GC.start
|
24
22
|
n2 = ObjectSpace.each_object(DVector){}
|
@@ -28,20 +26,20 @@ class TestDVector < Test::Unit::TestCase
|
|
28
26
|
|
29
27
|
def test_gc_stress
|
30
28
|
GC.stress = true
|
31
|
-
assert_nothing_thrown
|
32
|
-
|
33
|
-
|
29
|
+
#assert_nothing_thrown
|
30
|
+
make_dvs 10
|
31
|
+
|
34
32
|
ensure
|
35
33
|
GC.stress = false
|
36
34
|
end
|
37
35
|
|
38
36
|
def test_push_pop
|
39
37
|
dv = DVector.new
|
40
|
-
assert_nothing_thrown
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
38
|
+
#assert_nothing_thrown
|
39
|
+
dv.push(1)
|
40
|
+
dv.push(2)
|
41
|
+
dv.push(3)
|
42
|
+
|
45
43
|
assert_equal(3, dv.pop)
|
46
44
|
assert_equal(2, dv.pop)
|
47
45
|
assert_equal(1, dv.pop)
|
data/test/test_exit.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
1
|
require 'redshift'
|
4
2
|
|
5
3
|
include RedShift
|
@@ -33,9 +31,9 @@ end
|
|
33
31
|
|
34
32
|
#-----#
|
35
33
|
|
36
|
-
require '
|
34
|
+
require 'minitest/autorun'
|
37
35
|
|
38
|
-
class TestExit < Test
|
36
|
+
class TestExit < Minitest::Test
|
39
37
|
|
40
38
|
def setup
|
41
39
|
@world = World.new
|
data/test/test_flow.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
1
|
require 'redshift'
|
4
2
|
|
5
3
|
include RedShift
|
@@ -188,9 +186,9 @@ end
|
|
188
186
|
|
189
187
|
#-----#
|
190
188
|
|
191
|
-
require '
|
189
|
+
require 'minitest/autorun'
|
192
190
|
|
193
|
-
class TestFlow < Test
|
191
|
+
class TestFlow < Minitest::Test
|
194
192
|
|
195
193
|
def setup
|
196
194
|
@world = World.new
|
data/test/test_flow_link.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
1
|
require 'redshift'
|
4
2
|
|
5
3
|
include RedShift
|
@@ -242,9 +240,9 @@ end
|
|
242
240
|
|
243
241
|
#-----#
|
244
242
|
|
245
|
-
require '
|
243
|
+
require 'minitest/autorun'
|
246
244
|
|
247
|
-
class TestFlow < Test
|
245
|
+
class TestFlow < Minitest::Test
|
248
246
|
|
249
247
|
def setup
|
250
248
|
@world = World.new
|
data/test/test_flow_sub.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
1
|
require 'redshift'
|
4
2
|
|
5
3
|
include RedShift
|
@@ -54,9 +52,9 @@ end
|
|
54
52
|
|
55
53
|
#-----#
|
56
54
|
|
57
|
-
require '
|
55
|
+
require 'minitest/autorun'
|
58
56
|
|
59
|
-
class TestFlow < Test
|
57
|
+
class TestFlow < Minitest::Test
|
60
58
|
|
61
59
|
def setup
|
62
60
|
@world = World.new
|
data/test/test_flow_trans.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
1
|
require 'redshift'
|
4
2
|
require 'redshift/util/random'
|
5
3
|
require 'redshift/util/isaac'
|
@@ -231,9 +229,9 @@ end
|
|
231
229
|
|
232
230
|
#-----#
|
233
231
|
|
234
|
-
require '
|
232
|
+
require 'minitest/autorun'
|
235
233
|
|
236
|
-
class TestFlow < Test
|
234
|
+
class TestFlow < Minitest::Test
|
237
235
|
|
238
236
|
def setup
|
239
237
|
@world = World.new
|
data/test/test_inherit.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
1
|
require 'redshift'
|
4
2
|
|
5
3
|
include RedShift
|
@@ -89,9 +87,9 @@ class Z < Component
|
|
89
87
|
end
|
90
88
|
|
91
89
|
|
92
|
-
require '
|
90
|
+
require 'minitest/autorun'
|
93
91
|
|
94
|
-
class TestInherit < Test
|
92
|
+
class TestInherit < Minitest::Test
|
95
93
|
|
96
94
|
def setup
|
97
95
|
@world = World.new
|
data/test/test_inherit_event.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
1
|
require 'redshift'
|
4
2
|
|
5
3
|
include RedShift
|
@@ -44,9 +42,9 @@ end
|
|
44
42
|
|
45
43
|
#-----#
|
46
44
|
|
47
|
-
require '
|
45
|
+
require 'minitest/autorun'
|
48
46
|
|
49
|
-
class TestInheritEvent < Test
|
47
|
+
class TestInheritEvent < Minitest::Test
|
50
48
|
def setup
|
51
49
|
@world = World.new
|
52
50
|
@world.time_step = 0.1
|
data/test/test_inherit_flow.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
1
|
require 'redshift'
|
4
2
|
|
5
3
|
include RedShift
|
@@ -110,9 +108,9 @@ end
|
|
110
108
|
|
111
109
|
#-----#
|
112
110
|
|
113
|
-
require '
|
111
|
+
require 'minitest/autorun'
|
114
112
|
|
115
|
-
class TestInheritFlow < Test
|
113
|
+
class TestInheritFlow < Minitest::Test
|
116
114
|
|
117
115
|
def setup
|
118
116
|
@world = World.new
|
data/test/test_inherit_link.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
1
|
require 'redshift'
|
4
2
|
|
5
3
|
include RedShift
|
@@ -36,9 +34,9 @@ end
|
|
36
34
|
|
37
35
|
#-----#
|
38
36
|
|
39
|
-
require '
|
37
|
+
require 'minitest/autorun'
|
40
38
|
|
41
|
-
class TestInheritLink < Test
|
39
|
+
class TestInheritLink < Minitest::Test
|
42
40
|
|
43
41
|
def setup
|
44
42
|
@world = World.new
|
data/test/test_inherit_setup.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
1
|
require 'redshift'
|
4
2
|
|
5
3
|
include RedShift
|
@@ -34,9 +32,9 @@ end
|
|
34
32
|
|
35
33
|
#-----#
|
36
34
|
|
37
|
-
require '
|
35
|
+
require 'minitest/autorun'
|
38
36
|
|
39
|
-
class TestInheritSetup < Test
|
37
|
+
class TestInheritSetup < Minitest::Test
|
40
38
|
|
41
39
|
def setup
|
42
40
|
@world = World.new
|
data/test/test_inherit_state.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
1
|
require 'redshift'
|
4
2
|
|
5
3
|
include RedShift
|
@@ -35,9 +33,9 @@ end
|
|
35
33
|
|
36
34
|
#-----#
|
37
35
|
|
38
|
-
require '
|
36
|
+
require 'minitest/autorun'
|
39
37
|
|
40
|
-
class TestInheritState < Test
|
38
|
+
class TestInheritState < Minitest::Test
|
41
39
|
|
42
40
|
def setup
|
43
41
|
@world = World.new
|
@@ -1,5 +1,3 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
1
|
require 'redshift'
|
4
2
|
|
5
3
|
include RedShift
|
@@ -131,9 +129,9 @@ end
|
|
131
129
|
|
132
130
|
#-----#
|
133
131
|
|
134
|
-
require '
|
132
|
+
require 'minitest/autorun'
|
135
133
|
|
136
|
-
class TestInheritTrans < Test
|
134
|
+
class TestInheritTrans < Minitest::Test
|
137
135
|
|
138
136
|
def setup
|
139
137
|
@world = World.new
|
data/test/test_numerics.rb
CHANGED
@@ -1,8 +1,6 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
1
|
require 'mathn' # Use rationals for 1/2 etc.
|
4
2
|
|
5
|
-
require '
|
3
|
+
require 'minitest/autorun'
|
6
4
|
|
7
5
|
require 'redshift'
|
8
6
|
|
@@ -13,7 +11,7 @@ class Timer < Component
|
|
13
11
|
flow { diff " x' = 1 " }
|
14
12
|
end
|
15
13
|
|
16
|
-
class TestNumerics < Test
|
14
|
+
class TestNumerics < Minitest::Test
|
17
15
|
|
18
16
|
def setup
|
19
17
|
@world = World.new
|
data/test/test_queue.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'redshift'
|
2
|
-
require '
|
2
|
+
require 'minitest/autorun'
|
3
3
|
|
4
|
-
class TestQueue < Test
|
4
|
+
class TestQueue < Minitest::Test
|
5
5
|
class Receiver < RedShift::Component
|
6
6
|
queue :q
|
7
7
|
transition Enter => Exit do
|
@@ -37,7 +37,7 @@ class TestQueue < Test::Unit::TestCase
|
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
|
-
class TestQueueAndStrict < Test
|
40
|
+
class TestQueueAndStrict < Minitest::Test
|
41
41
|
class Receiver < RedShift::Component
|
42
42
|
queue :q
|
43
43
|
strictly_continuous :x
|
data/test/test_queue_alone.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
require 'redshift/queue'
|
2
|
-
require '
|
2
|
+
require 'minitest/autorun'
|
3
3
|
|
4
4
|
# Test queue class outside of simulation using mocked World and
|
5
5
|
# Component classes.
|
6
|
-
class TestQueueAlone < Test
|
6
|
+
class TestQueueAlone < Minitest::Test
|
7
7
|
class World
|
8
8
|
attr_accessor :step_count, :discrete_step
|
9
9
|
end
|
data/test/test_reset.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
1
|
require 'redshift'
|
4
2
|
|
5
3
|
include RedShift
|
@@ -111,9 +109,9 @@ class Receiver < Component
|
|
111
109
|
end
|
112
110
|
end
|
113
111
|
|
114
|
-
require '
|
112
|
+
require 'minitest/autorun'
|
115
113
|
|
116
|
-
class TestReset < Test
|
114
|
+
class TestReset < Minitest::Test
|
117
115
|
|
118
116
|
def setup
|
119
117
|
@world = World.new
|
data/test/test_setup.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
1
|
require 'redshift'
|
4
2
|
|
5
3
|
include RedShift
|
@@ -90,9 +88,9 @@ end
|
|
90
88
|
|
91
89
|
#-----#
|
92
90
|
|
93
|
-
require '
|
91
|
+
require 'minitest/autorun'
|
94
92
|
|
95
|
-
class TestSetup < Test
|
93
|
+
class TestSetup < Minitest::Test
|
96
94
|
|
97
95
|
def setup
|
98
96
|
@world = World.new
|
@@ -1,5 +1,3 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
1
|
require 'redshift'
|
4
2
|
|
5
3
|
include RedShift
|
@@ -347,9 +345,9 @@ end
|
|
347
345
|
|
348
346
|
#-----#
|
349
347
|
|
350
|
-
require '
|
348
|
+
require 'minitest/autorun'
|
351
349
|
|
352
|
-
class TestStrictContinuity < Test
|
350
|
+
class TestStrictContinuity < Minitest::Test
|
353
351
|
|
354
352
|
def setup
|
355
353
|
@world = SCWorld.new
|
@@ -1,14 +1,12 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
1
|
require 'redshift'
|
4
2
|
|
5
3
|
include RedShift
|
6
4
|
|
7
|
-
require '
|
5
|
+
require 'minitest/autorun'
|
8
6
|
|
9
7
|
# See also test_strict_continuity.rb.
|
10
8
|
|
11
|
-
class TestStrictnessError < Test
|
9
|
+
class TestStrictnessError < Minitest::Test
|
12
10
|
|
13
11
|
class T < Component
|
14
12
|
|
@@ -1,14 +1,12 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
1
|
require 'redshift'
|
4
2
|
|
5
3
|
include RedShift
|
6
4
|
|
7
|
-
require '
|
5
|
+
require 'minitest/autorun'
|
8
6
|
|
9
7
|
# See also test_strict_continuity.rb.
|
10
8
|
|
11
|
-
class TestStrictnessError < Test
|
9
|
+
class TestStrictnessError < Minitest::Test
|
12
10
|
|
13
11
|
class T < Component
|
14
12
|
|
data/test/test_sync.rb
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
# test chains of symmetric sync
|
5
5
|
|
6
6
|
require 'redshift'
|
7
|
-
require '
|
7
|
+
require 'minitest/autorun'
|
8
8
|
|
9
9
|
class DebugSyncWorld #< RedShift::World
|
10
10
|
def hook_begin
|
@@ -25,7 +25,7 @@ class DebugSyncWorld #< RedShift::World
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
-
class TestSync < Test
|
28
|
+
class TestSync < Minitest::Test
|
29
29
|
class Relay < RedShift::Component
|
30
30
|
link :next
|
31
31
|
|
data/test/test_world.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
1
|
require 'redshift'
|
4
2
|
|
5
3
|
include RedShift
|
@@ -285,9 +283,9 @@ tests:
|
|
285
283
|
|
286
284
|
#-----#
|
287
285
|
|
288
|
-
require '
|
286
|
+
require 'minitest/autorun'
|
289
287
|
|
290
|
-
class TestWorld < Test
|
288
|
+
class TestWorld < Minitest::Test
|
291
289
|
|
292
290
|
def test_world
|
293
291
|
testers = []
|
metadata
CHANGED
@@ -1,15 +1,57 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redshift
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.27
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joel VanderWerf
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
12
|
-
dependencies:
|
11
|
+
date: 2013-06-01 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: cgen
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: tkar
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: prng-isaac
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
13
55
|
description: A framework for simulation of networks of hybrid automata, similar to
|
14
56
|
SHIFT and Lambda-SHIFT. Includes ruby-based DSL for defining simulation components,
|
15
57
|
and ruby/C code generation and runtime.
|
@@ -18,11 +60,11 @@ executables: []
|
|
18
60
|
extensions:
|
19
61
|
- ext/redshift/buffer/extconf.rb
|
20
62
|
- ext/redshift/dvector/extconf.rb
|
21
|
-
- ext/redshift/util/isaac/extconf.rb
|
22
63
|
extra_rdoc_files:
|
23
64
|
- README.md
|
24
65
|
- RELEASE-NOTES
|
25
66
|
files:
|
67
|
+
- Rakefile
|
26
68
|
- README.md
|
27
69
|
- RELEASE-NOTES
|
28
70
|
- bench/bench
|
@@ -87,18 +129,14 @@ files:
|
|
87
129
|
- examples/simulink/README
|
88
130
|
- ext/redshift/dvector/dvector.c
|
89
131
|
- ext/redshift/buffer/buffer.c
|
90
|
-
- ext/redshift/util/isaac/isaac.c
|
91
|
-
- ext/redshift/util/isaac/rand.c
|
92
132
|
- ext/redshift/dvector-float/dvector-float.c
|
93
133
|
- ext/redshift/dvector/dvector.h
|
94
134
|
- ext/redshift/buffer/buffer.h
|
95
|
-
- ext/redshift/util/isaac/rand.h
|
96
135
|
- ext/redshift/dvector-float/dvector-float.h
|
97
136
|
- ext/redshift/dvector/dvector.rb
|
98
137
|
- ext/redshift/dvector/extconf.rb
|
99
138
|
- ext/redshift/buffer/dir.rb
|
100
139
|
- ext/redshift/buffer/extconf.rb
|
101
|
-
- ext/redshift/util/isaac/extconf.rb
|
102
140
|
- ext/redshift/dvector-float/dvector-float.rb
|
103
141
|
- ext/redshift/dvector-float/extconf.rb
|
104
142
|
- lib/redshift/state.rb
|
@@ -185,6 +223,8 @@ rdoc_options:
|
|
185
223
|
- CGenerator
|
186
224
|
- --main
|
187
225
|
- README.md
|
226
|
+
- --output
|
227
|
+
- rdoc
|
188
228
|
require_paths:
|
189
229
|
- lib
|
190
230
|
- ext
|
@@ -205,3 +245,4 @@ signing_key:
|
|
205
245
|
specification_version: 4
|
206
246
|
summary: Simulation of hybrid automata
|
207
247
|
test_files: []
|
248
|
+
has_rdoc:
|
@@ -1,129 +0,0 @@
|
|
1
|
-
#include "ruby.h"
|
2
|
-
#include "rand.h"
|
3
|
-
|
4
|
-
#ifndef min
|
5
|
-
# define min(a,b) (((a)<(b)) ? (a) : (b))
|
6
|
-
#endif /* min */
|
7
|
-
|
8
|
-
static VALUE
|
9
|
-
ISAAC_s_allocate(VALUE klass)
|
10
|
-
{
|
11
|
-
randctx *ctx;
|
12
|
-
|
13
|
-
return Data_Make_Struct(klass, randctx, NULL, NULL, ctx);
|
14
|
-
}
|
15
|
-
|
16
|
-
/*
|
17
|
-
* Seed the generator with an array of up to ISAAC::RANDSIZ integers in the
|
18
|
-
* range 0..2**32-1. More entries are ignored. Missing entries are treated
|
19
|
-
* as 0. Returns +nil+.
|
20
|
-
*/
|
21
|
-
static VALUE
|
22
|
-
ISAAC_srand(VALUE self, VALUE ary)
|
23
|
-
{
|
24
|
-
int i;
|
25
|
-
randctx *ctx;
|
26
|
-
|
27
|
-
Check_Type(ary, T_ARRAY);
|
28
|
-
|
29
|
-
Data_Get_Struct(self, randctx, ctx);
|
30
|
-
|
31
|
-
MEMZERO(ctx, randctx, 1);
|
32
|
-
for (i=min(RANDSIZ, RARRAY_LEN(ary))-1; i>=0; i--) {
|
33
|
-
ctx->randrsl[i] = NUM2UINT(RARRAY_PTR(ary)[i]);
|
34
|
-
}
|
35
|
-
rs_isaac_init(ctx, 1);
|
36
|
-
|
37
|
-
return Qnil;
|
38
|
-
}
|
39
|
-
|
40
|
-
/*
|
41
|
-
* Return a random integer in the range 0..2**32-1.
|
42
|
-
*/
|
43
|
-
static VALUE
|
44
|
-
ISAAC_rand32(VALUE self)
|
45
|
-
{
|
46
|
-
randctx *ctx;
|
47
|
-
|
48
|
-
Data_Get_Struct(self, randctx, ctx);
|
49
|
-
|
50
|
-
if (!ctx->randcnt--) {
|
51
|
-
rs_isaac_rand(ctx);
|
52
|
-
ctx->randcnt=RANDSIZ-1;
|
53
|
-
}
|
54
|
-
|
55
|
-
return UINT2NUM(ctx->randrsl[ctx->randcnt]);
|
56
|
-
}
|
57
|
-
|
58
|
-
/*
|
59
|
-
* Return a random float in the range 0..1.
|
60
|
-
*/
|
61
|
-
static VALUE
|
62
|
-
ISAAC_rand(VALUE self)
|
63
|
-
{
|
64
|
-
randctx *ctx;
|
65
|
-
|
66
|
-
Data_Get_Struct(self, randctx, ctx);
|
67
|
-
|
68
|
-
if (!ctx->randcnt--) {
|
69
|
-
rs_isaac_rand(ctx);
|
70
|
-
ctx->randcnt=RANDSIZ-1;
|
71
|
-
}
|
72
|
-
|
73
|
-
return rb_float_new(ctx->randrsl[ctx->randcnt] / 4294967295.0);
|
74
|
-
}
|
75
|
-
|
76
|
-
/* :nodoc: */
|
77
|
-
static VALUE
|
78
|
-
ISAAC_marshal_dump(VALUE self)
|
79
|
-
{
|
80
|
-
randctx *ctx;
|
81
|
-
int i;
|
82
|
-
int ary_size = sizeof(randctx)/sizeof(ub4);
|
83
|
-
VALUE ary;
|
84
|
-
|
85
|
-
Data_Get_Struct(self, randctx, ctx);
|
86
|
-
|
87
|
-
ary = rb_ary_new2(ary_size);
|
88
|
-
for (i = 0; i < ary_size; i++) {
|
89
|
-
rb_ary_push(ary, UINT2NUM(((ub4 *)ctx)[i]));
|
90
|
-
}
|
91
|
-
|
92
|
-
return ary;
|
93
|
-
}
|
94
|
-
|
95
|
-
/* :nodoc: */
|
96
|
-
static VALUE
|
97
|
-
ISAAC_marshal_load(VALUE self, VALUE ary)
|
98
|
-
{
|
99
|
-
randctx *ctx;
|
100
|
-
int i;
|
101
|
-
int ary_size = sizeof(randctx)/sizeof(ub4);
|
102
|
-
|
103
|
-
Data_Get_Struct(self, randctx, ctx);
|
104
|
-
|
105
|
-
if (RARRAY_LEN(ary) != ary_size)
|
106
|
-
rb_raise(rb_eArgError, "bad length in loaded ISAAC data");
|
107
|
-
|
108
|
-
for (i = 0; i < ary_size; i++) {
|
109
|
-
((ub4 *)ctx)[i] = NUM2UINT(RARRAY_PTR(ary)[i]);
|
110
|
-
}
|
111
|
-
|
112
|
-
return self;
|
113
|
-
}
|
114
|
-
|
115
|
-
void
|
116
|
-
Init_isaac()
|
117
|
-
{
|
118
|
-
VALUE ISAAC;
|
119
|
-
|
120
|
-
ISAAC = rb_define_class("ISAAC", rb_cObject);
|
121
|
-
rb_define_alloc_func(ISAAC, ISAAC_s_allocate);
|
122
|
-
rb_define_method(ISAAC, "srand", ISAAC_srand, 1);
|
123
|
-
rb_define_method(ISAAC, "rand32", ISAAC_rand32, 0);
|
124
|
-
rb_define_method(ISAAC, "rand", ISAAC_rand, 0);
|
125
|
-
rb_define_method(ISAAC, "marshal_dump", ISAAC_marshal_dump, 0);
|
126
|
-
rb_define_method(ISAAC, "marshal_load", ISAAC_marshal_load, 1);
|
127
|
-
|
128
|
-
rb_const_set(ISAAC, rb_intern("RANDSIZ"), UINT2NUM(RANDSIZ));
|
129
|
-
}
|
@@ -1,140 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
------------------------------------------------------------------------------
|
3
|
-
rand.c: By Bob Jenkins. My random number generator, ISAAC. Public Domain.
|
4
|
-
MODIFIED:
|
5
|
-
960327: Creation (addition of randinit, really)
|
6
|
-
970719: use context, not global variables, for internal state
|
7
|
-
980324: added main (ifdef'ed out), also rearranged randinit()
|
8
|
-
010626: Note that this is public domain
|
9
|
-
|
10
|
-
ADAPTED Aug2004 for use in Ruby by Joel VanderWerf
|
11
|
-
ADAPTED Jan2010 for 64 bit systems (same algorithm and results as 32 bit)
|
12
|
-
ADAPTED Jun2010 for use within the redshift project
|
13
|
-
------------------------------------------------------------------------------
|
14
|
-
*/
|
15
|
-
#ifndef RAND
|
16
|
-
#include "rand.h"
|
17
|
-
#endif
|
18
|
-
|
19
|
-
|
20
|
-
#define ind(mm,x) ((mm)[(x>>2)&(RANDSIZ-1)])
|
21
|
-
#define rngstep(mix,a,b,mm,m,m2,r,x) \
|
22
|
-
{ \
|
23
|
-
x = *m; \
|
24
|
-
a = ((a^(mix)) + *(m2++)); \
|
25
|
-
*(m++) = y = (ind(mm,x) + a + b); \
|
26
|
-
*(r++) = b = (ind(mm,y>>RANDSIZL) + x); \
|
27
|
-
}
|
28
|
-
|
29
|
-
void rs_isaac_rand(ctx)
|
30
|
-
randctx *ctx;
|
31
|
-
{
|
32
|
-
register ub4 a,b,x,y,*m,*mm,*m2,*r,*mend;
|
33
|
-
mm=ctx->randmem; r=ctx->randrsl;
|
34
|
-
a = ctx->randa; b = (ctx->randb + (++ctx->randc));
|
35
|
-
for (m = mm, mend = m2 = m+(RANDSIZ/2); m<mend; )
|
36
|
-
{
|
37
|
-
rngstep( a<<13, a, b, mm, m, m2, r, x);
|
38
|
-
rngstep( a>>6 , a, b, mm, m, m2, r, x);
|
39
|
-
rngstep( a<<2 , a, b, mm, m, m2, r, x);
|
40
|
-
rngstep( a>>16, a, b, mm, m, m2, r, x);
|
41
|
-
}
|
42
|
-
for (m2 = mm; m2<mend; )
|
43
|
-
{
|
44
|
-
rngstep( a<<13, a, b, mm, m, m2, r, x);
|
45
|
-
rngstep( a>>6 , a, b, mm, m, m2, r, x);
|
46
|
-
rngstep( a<<2 , a, b, mm, m, m2, r, x);
|
47
|
-
rngstep( a>>16, a, b, mm, m, m2, r, x);
|
48
|
-
}
|
49
|
-
ctx->randb = b; ctx->randa = a;
|
50
|
-
}
|
51
|
-
|
52
|
-
|
53
|
-
#define mix(a,b,c,d,e,f,g,h) \
|
54
|
-
{ \
|
55
|
-
a^=b<<11; d+=a; b+=c; \
|
56
|
-
b^=c>>2; e+=b; c+=d; \
|
57
|
-
c^=d<<8; f+=c; d+=e; \
|
58
|
-
d^=e>>16; g+=d; e+=f; \
|
59
|
-
e^=f<<10; h+=e; f+=g; \
|
60
|
-
f^=g>>4; a+=f; g+=h; \
|
61
|
-
g^=h<<8; b+=g; h+=a; \
|
62
|
-
h^=a>>9; c+=h; a+=b; \
|
63
|
-
}
|
64
|
-
|
65
|
-
/* if (flag==TRUE), then use the contents of randrsl[] to initialize mm[]. */
|
66
|
-
void rs_isaac_init(ctx, flag)
|
67
|
-
randctx *ctx;
|
68
|
-
int flag;
|
69
|
-
{
|
70
|
-
int i;
|
71
|
-
ub4 a,b,c,d,e,f,g,h;
|
72
|
-
ub4 *m,*r;
|
73
|
-
ctx->randa = ctx->randb = ctx->randc = 0;
|
74
|
-
m=ctx->randmem;
|
75
|
-
r=ctx->randrsl;
|
76
|
-
a=b=c=d=e=f=g=h=0x9e3779b9; /* the golden ratio */
|
77
|
-
|
78
|
-
for (i=0; i<4; ++i) /* scramble it */
|
79
|
-
{
|
80
|
-
mix(a,b,c,d,e,f,g,h);
|
81
|
-
}
|
82
|
-
|
83
|
-
if (flag)
|
84
|
-
{
|
85
|
-
/* initialize using the contents of r[] as the seed */
|
86
|
-
for (i=0; i<RANDSIZ; i+=8)
|
87
|
-
{
|
88
|
-
a+=r[i ]; b+=r[i+1]; c+=r[i+2]; d+=r[i+3];
|
89
|
-
e+=r[i+4]; f+=r[i+5]; g+=r[i+6]; h+=r[i+7];
|
90
|
-
mix(a,b,c,d,e,f,g,h);
|
91
|
-
m[i ]=a; m[i+1]=b; m[i+2]=c; m[i+3]=d;
|
92
|
-
m[i+4]=e; m[i+5]=f; m[i+6]=g; m[i+7]=h;
|
93
|
-
}
|
94
|
-
/* do a second pass to make all of the seed affect all of m */
|
95
|
-
for (i=0; i<RANDSIZ; i+=8)
|
96
|
-
{
|
97
|
-
a+=m[i ]; b+=m[i+1]; c+=m[i+2]; d+=m[i+3];
|
98
|
-
e+=m[i+4]; f+=m[i+5]; g+=m[i+6]; h+=m[i+7];
|
99
|
-
mix(a,b,c,d,e,f,g,h);
|
100
|
-
m[i ]=a; m[i+1]=b; m[i+2]=c; m[i+3]=d;
|
101
|
-
m[i+4]=e; m[i+5]=f; m[i+6]=g; m[i+7]=h;
|
102
|
-
}
|
103
|
-
}
|
104
|
-
else
|
105
|
-
{
|
106
|
-
/* fill in mm[] with messy stuff */
|
107
|
-
for (i=0; i<RANDSIZ; i+=8)
|
108
|
-
{
|
109
|
-
mix(a,b,c,d,e,f,g,h);
|
110
|
-
m[i ]=a; m[i+1]=b; m[i+2]=c; m[i+3]=d;
|
111
|
-
m[i+4]=e; m[i+5]=f; m[i+6]=g; m[i+7]=h;
|
112
|
-
}
|
113
|
-
}
|
114
|
-
|
115
|
-
rs_isaac_rand(ctx); /* fill in the first set of results */
|
116
|
-
ctx->randcnt=RANDSIZ; /* prepare to use the first set of results */
|
117
|
-
}
|
118
|
-
|
119
|
-
|
120
|
-
#ifdef NEVER
|
121
|
-
#include <stdio.h>
|
122
|
-
|
123
|
-
int main()
|
124
|
-
{
|
125
|
-
ub4 i,j;
|
126
|
-
randctx ctx;
|
127
|
-
ctx.randa=ctx.randb=ctx.randc=(ub4)0;
|
128
|
-
for (i=0; i<RANDSIZ; ++i) ctx.randrsl[i]=(ub4)0;
|
129
|
-
rs_isaac_init(&ctx, 1);
|
130
|
-
for (i=0; i<2; ++i)
|
131
|
-
{
|
132
|
-
rs_isaac_rand(&ctx);
|
133
|
-
for (j=0; j<RANDSIZ; ++j)
|
134
|
-
{
|
135
|
-
printf("%.8lx",(long unsigned int)ctx.randrsl[j]);
|
136
|
-
if ((j&7)==7) printf("\n");
|
137
|
-
}
|
138
|
-
}
|
139
|
-
}
|
140
|
-
#endif
|
@@ -1,61 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
------------------------------------------------------------------------------
|
3
|
-
rand.h: definitions for a random number generator
|
4
|
-
By Bob Jenkins, 1996, Public Domain
|
5
|
-
MODIFIED:
|
6
|
-
960327: Creation (addition of randinit, really)
|
7
|
-
970719: use context, not global variables, for internal state
|
8
|
-
980324: renamed seed to flag
|
9
|
-
980605: recommend RANDSIZL=4 for noncryptography.
|
10
|
-
010626: note this is public domain
|
11
|
-
|
12
|
-
ADAPTED Aug2004 for use in Ruby by Joel VanderWerf
|
13
|
-
ADAPTED Jan2010 for 64 bit systems (same algorithm and results as 32 bit)
|
14
|
-
ADAPTED Jun2010 for use within the redshift project
|
15
|
-
------------------------------------------------------------------------------
|
16
|
-
*/
|
17
|
-
|
18
|
-
#include <stdint.h>
|
19
|
-
|
20
|
-
typedef uint32_t ub4;
|
21
|
-
|
22
|
-
#ifndef RAND
|
23
|
-
#define RAND
|
24
|
-
#define RANDSIZL (8) /* I recommend 8 for crypto, 4 for simulations */
|
25
|
-
#define RANDSIZ (1<<RANDSIZL)
|
26
|
-
|
27
|
-
/* context of random number generator */
|
28
|
-
struct randctx
|
29
|
-
{
|
30
|
-
ub4 randcnt;
|
31
|
-
ub4 randrsl[RANDSIZ];
|
32
|
-
ub4 randmem[RANDSIZ];
|
33
|
-
ub4 randa;
|
34
|
-
ub4 randb;
|
35
|
-
ub4 randc;
|
36
|
-
};
|
37
|
-
typedef struct randctx randctx;
|
38
|
-
|
39
|
-
/*
|
40
|
-
------------------------------------------------------------------------------
|
41
|
-
If (flag==TRUE), then use the contents of randrsl[0..RANDSIZ-1] as the seed.
|
42
|
-
------------------------------------------------------------------------------
|
43
|
-
*/
|
44
|
-
void rs_isaac_init(randctx *r, int flag);
|
45
|
-
|
46
|
-
void rs_isaac_rand(randctx *r);
|
47
|
-
|
48
|
-
|
49
|
-
/*
|
50
|
-
------------------------------------------------------------------------------
|
51
|
-
Call rand(/o_ randctx *r _o/) to retrieve a single 32-bit random value
|
52
|
-
------------------------------------------------------------------------------
|
53
|
-
*/
|
54
|
-
#define rand(r) \
|
55
|
-
(!(r)->randcnt-- ? \
|
56
|
-
(rs_isaac_rand(r), (r)->randcnt=RANDSIZ-1, (r)->randrsl[(r)->randcnt]) : \
|
57
|
-
(r)->randrsl[(r)->randcnt])
|
58
|
-
|
59
|
-
#endif /* RAND */
|
60
|
-
|
61
|
-
|