Commits

Taku Miyakawa committed c9c3d13

Removes CORE.random

Comments (0)

Files changed (2)

src/main/java/org/kink_lang/kink/internal/module/Core.java

 import java.nio.file.Paths;
 import java.util.List;
 import java.util.ArrayList;
-import java.util.Random;
 import java.math.BigInteger;
 
 /** CORE module. */
         }
 
 
-        /** Random number generator for {@code random} function. */
-        private final Random rng = RandomNumbers.newMersenneTwister();
-
-
-        @Define
-        public Value random( Number upperBoundExclusive ) {
-            synchronized ( rng ) {
-                return RandomNumbers.randomNumber( rng , upperBoundExclusive );
-            }
-        }
-
-
         @Define
         public Value random_number_generator( @Optional Value seedVal ) {
             if ( seedVal == null ) {

src/test/java/org/kink_lang/kink/internal/module/CoreTest.java

 
 
     @Test
-    public void random_number() {
-        GetSite random = new GetSite( "random" );
-        assertThat( core.call( random , Value.value( 42 ) ).unbox() , is( Integer.class ) );
-        assertThat( core.call( random , Value.value( 42 ) ).unbox() , is( Integer.class ) );
-        assertThat( core.call( random , Value.value( Long.MAX_VALUE ) ).unbox()
-                , is( Number.class ) );
-        assertThat( core.call( random , Value.value( Long.MAX_VALUE ) ).unbox()
-                , is( Number.class ) );
-        assertThat( core.call( random , Value.value( Long.MAX_VALUE ) ).unbox()
-                , is( Number.class ) );
-    }
-
-
-    @Test( expected = KinkException.class )
-    public void random_fails_if_the_upper_bound_is_negative() {
-        GetSite random = new GetSite( "random" );
-        core.call( random , Value.value( - 1 ) );
-    }
-
-
-    @Test
     public void make_rng_with_default_seed() {
         Random rng = (Random) core.call( new GetSite( "random_number_generator" ) ).unbox();
         assertThat( rng.nextInt() , is( Integer.class ) );