Class Random

java.lang.Object
org.rapidcontext.core.security.Random

public class Random extends Object
Helper methods for random data, useful for secrets and keys.
  • Method Details

    • bytes

      public static byte[] bytes(int size)
      Creates an array with random bytes.
      Parameters:
      size - the array size (in bytes)
      Returns:
      the byte array
    • base64

      public static String base64(int size)
      Creates a Base64 encoded string with random bytes.
      Parameters:
      size - the number of bytes
      Returns:
      the Base64 encoded string