Sha256: d0319fcebd7054332ab746b4f6e30d6471a99643275f1cc8554506529a0bcfb8

Contents?: true

Size: 709 Bytes

Versions: 119

Compression:

Stored size: 709 Bytes

Contents

package j2me.util;

import java.util.Random;

public class RandomMe {
    private static final int BITS_PER_BYTE = 8;
    private static final int BYTES_PER_INT = 4;

    public static void nextBytes(Random rndThis, byte[] bytes) {
        int numRequested = bytes.length;

        int numGot = 0, rnd = 0;

        while (true) {
            for (int i = 0; i < BYTES_PER_INT; i++) {
                if (numGot == numRequested)
                    return;

                //TODO: rndThis.next
                rnd = (i==0 ? 0/*rndThis.next(BITS_PER_BYTE * BYTES_PER_INT)*/
                            : rnd >> BITS_PER_BYTE);
                bytes[numGot++] = (byte)rnd;
            }
        }
    }
    
}

Version data entries

119 entries across 119 versions & 1 rubygems

Version Path
rhodes-2.2.5.beta.1 platform/bb/RubyVM/src/j2me/util/RandomMe.java
rhodes-2.2.4.beta.1 platform/bb/RubyVM/src/j2me/util/RandomMe.java
rhodes-2.2.3 platform/bb/RubyVM/src/j2me/util/RandomMe.java
rhodes-2.2.3.beta.1 platform/bb/RubyVM/src/j2me/util/RandomMe.java
rhodes-2.2.2 platform/bb/RubyVM/src/j2me/util/RandomMe.java
rhodes-2.2.2.beta.1 platform/bb/RubyVM/src/j2me/util/RandomMe.java
rhodes-2.2.1 platform/bb/RubyVM/src/j2me/util/RandomMe.java
rhodes-2.2.1.beta.2 platform/bb/RubyVM/src/j2me/util/RandomMe.java
rhodes-2.2.1.beta.1 platform/bb/RubyVM/src/j2me/util/RandomMe.java
rhodes-2.2.0 platform/bb/RubyVM/src/j2me/util/RandomMe.java
rhodes-2.2.0.beta.3 platform/bb/RubyVM/src/j2me/util/RandomMe.java
rhodes-2.2.0.beta.2 platform/bb/RubyVM/src/j2me/util/RandomMe.java
rhodes-2.2.0.beta.1 platform/bb/RubyVM/src/j2me/util/RandomMe.java
rhodes-2.1.0 platform/bb/RubyVM/src/j2me/util/RandomMe.java
rhodes-2.0.3 platform/shared/rubyJVM/src/j2me/util/RandomMe.java
rhodes-2.0.2 platform/shared/rubyJVM/src/j2me/util/RandomMe.java
rhodes-2.0.0 platform/shared/rubyJVM/src/j2me/util/RandomMe.java
rhodes-2.0.0.rc2 platform/shared/rubyJVM/src/j2me/util/RandomMe.java
rhodes-2.0.0.rc1 platform/shared/rubyJVM/src/j2me/util/RandomMe.java
rhodes-2.0.0.beta11 platform/shared/rubyJVM/src/j2me/util/RandomMe.java