Skip to main content
added 33 characters in body
Source Link
the default.
  • 8.4k
  • 1
  • 36
  • 62

x86-64 machine code, 10 bytes

Fortunately, there is a built-in RNG. Requires the RDRAND instruction.

00000000: c1e1 020f c7f0 abe2 fac3                 ..........

Disassembled:

shl ecx, 2
label:
 rdrand eax
 stosd
 loop label
ret

Outputs to a pre-allocated buffer in rdi. n is passed in ecx (arrays with 2^30 elements and more are not supported).

Try it online! (a helper function is needed because of the unusual calling convention)

x86-64 machine code, 10 bytes

Fortunately, there is a built-in RNG.

00000000: c1e1 020f c7f0 abe2 fac3                 ..........

Disassembled:

shl ecx, 2
label:
 rdrand eax
 stosd
 loop label
ret

Outputs to a pre-allocated buffer in rdi. n is passed in ecx (arrays with 2^30 elements and more are not supported).

Try it online! (a helper function is needed because of the unusual calling convention)

x86-64 machine code, 10 bytes

Fortunately, there is a built-in RNG. Requires the RDRAND instruction.

00000000: c1e1 020f c7f0 abe2 fac3                 ..........

Disassembled:

shl ecx, 2
label:
 rdrand eax
 stosd
 loop label
ret

Outputs to a pre-allocated buffer in rdi. n is passed in ecx (arrays with 2^30 elements and more are not supported).

Try it online! (a helper function is needed because of the unusual calling convention)

added 669 characters in body
Source Link
the default.
  • 8.4k
  • 1
  • 36
  • 62

x86-64 machine code, 10 bytes

Fortunately, there is a built-in RNG.

00000000: c1e1 020f c7f0 abe2 fac3                 ..........

Disassembled:

shl ecx, 2
label:
 rdrand eax
 stosd
 loop label
ret

Outputs to a pre-allocated buffer in rdi. n is passed in ecx (arrays with 2^30 elements and more are not supported).

Try it online! (a helper function is needed because of the unusual calling convention)

x86-64 machine code, 10 bytes

Fortunately, there is a built-in RNG.

00000000: c1e1 020f c7f0 abe2 fac3                 ..........

Disassembled:

shl ecx, 2
label:
 rdrand eax
 stosd
 loop label
ret

Outputs to a pre-allocated buffer in rdi. n is passed in ecx (arrays with 2^30 elements and more are not supported).

x86-64 machine code, 10 bytes

Fortunately, there is a built-in RNG.

00000000: c1e1 020f c7f0 abe2 fac3                 ..........

Disassembled:

shl ecx, 2
label:
 rdrand eax
 stosd
 loop label
ret

Outputs to a pre-allocated buffer in rdi. n is passed in ecx (arrays with 2^30 elements and more are not supported).

Try it online! (a helper function is needed because of the unusual calling convention)

Source Link
the default.
  • 8.4k
  • 1
  • 36
  • 62

x86-64 machine code, 10 bytes

Fortunately, there is a built-in RNG.

00000000: c1e1 020f c7f0 abe2 fac3                 ..........

Disassembled:

shl ecx, 2
label:
 rdrand eax
 stosd
 loop label
ret

Outputs to a pre-allocated buffer in rdi. n is passed in ecx (arrays with 2^30 elements and more are not supported).