View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    *
9    *      http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  
18  package org.apache.commons.rng.core.source32;
19  
20  import org.apache.commons.rng.core.RandomAssert;
21  import org.junit.jupiter.api.Test;
22  
23  class JenkinsSmallFast32Test {
24      @Test
25      void testReferenceCode() {
26          /*
27           * Tested with respect to the original reference:
28           * See : https://burtleburtle.net/bob/rand/smallprng.html
29           */
30          final int[] expectedSequence = {
31              0x3b05df0d, 0xc1b222b1, 0xdc38504a, 0x5a929fee,
32              0x695f52ee, 0x49246926, 0xeaca3aaa, 0xb7ea1598,
33              0x6f946a66, 0xf4eddf53, 0x4235b7bf, 0x4b1eb3c6,
34              0xffa13fa2, 0x095ab9fc, 0x64dc8c5c, 0x3ad18ba8,
35              0xb5f8354d, 0x744ef6de, 0xff9d2943, 0xb3d54756,
36              0x096e9c74, 0x142a29c5, 0xcf090298, 0x71823d63,
37              0x587052d2, 0xb843e5ed, 0x670e0279, 0xc5bb26d5,
38              0xc28d61e0, 0xd31aedaf, 0x52fe2b77, 0x65f50ec7,
39              0x522a44c5, 0x25f4baf8, 0x9fd1d806, 0x3a24f3bc,
40              0x78f2aac1, 0xce496e14, 0x74d186b8, 0x34ff8809,
41          };
42          RandomAssert.assertEquals(expectedSequence, new JenkinsSmallFast32(0xb5ad4ece));
43      }
44  }