File tree Expand file tree Collapse file tree 5 files changed +28
-2
lines changed
spec/truffle/tags/core/random
truffle/src/main/java/org/jruby/truffle Expand file tree Collapse file tree 5 files changed +28
-2
lines changed Original file line number Diff line number Diff line change 1- fails:Random.new returns a new instance of Random
21fails:Random.new uses a random seed value if none is supplied
32fails:Random.new returns Random instances initialized with different seeds
43fails:Random.new accepts an Integer seed value as an argument
Original file line number Diff line number Diff line change 5353 RubyEncoding .class , //
5454 RubySymbol .class , //
5555 RubyThread .class , //
56- RubyTime .class , //
56+ RubyTime .class ,
57+ RubyRandom .class , //
5758 RubyEncodingConverter .class , //
5859 RubyMethod .class , //
5960 RubyUnboundMethod .class , //
Original file line number Diff line number Diff line change 1+ package org .jruby .truffle .nodes .core ;
2+
3+ @ CoreClass (name = "Random" )
4+ public abstract class RandomNodes {
5+
6+ }
Original file line number Diff line number Diff line change @@ -98,6 +98,7 @@ public class CoreLibrary {
9898 private final RubyClass securityErrorClass ;
9999 private final RubyClass standardErrorClass ;
100100 private final RubyClass stringClass ;
101+ private final RubyClass randomClass ;
101102 private final RubyClass stringDataClass ;
102103 private final RubyClass symbolClass ;
103104 private final RubyClass syntaxErrorClass ;
@@ -284,6 +285,7 @@ public CoreLibrary(RubyContext context) {
284285 rangeClass = defineClass ("Range" , new RubyRange .RangeAllocator ());
285286 regexpClass = defineClass ("Regexp" , new RubyRegexp .RegexpAllocator ());
286287 stringClass = defineClass ("String" , new RubyString .StringAllocator ());
288+ randomClass = defineClass ("Random" );
287289 symbolClass = defineClass ("Symbol" );
288290 threadClass = defineClass ("Thread" , new RubyThread .ThreadAllocator ());
289291 timeClass = defineClass ("Time" , new RubyTime .TimeAllocator ());
Original file line number Diff line number Diff line change 1+ package org .jruby .truffle .runtime .core ;
2+
3+ /**
4+ * Represents the Ruby {@code Random} class.
5+ */
6+ public class RubyRandom extends RubyBasicObject {
7+
8+ private Long seedValue ;
9+
10+ public RubyRandom (RubyClass randomClass ) {
11+ super (randomClass );
12+ }
13+
14+ public void setSeedValue (Long seedValue ) {
15+ this .seedValue = seedValue ;
16+ }
17+
18+ }
You can’t perform that action at this time.
0 commit comments