Files
aji/tests/conformance/phase2/run/random_golden_vector.air
T
dev 7a74be3cf7 spec: bit-exact PRNG, canonical run record, global quiescence
Owner review of the RFC 0007 implementation:
- spec 11 §8.1: xoshiro256** with SplitMix64 seeding specified bit for
  bit, fill consumes ceil(n/8) outputs LSB first; golden vector; own
  implementation replaces std.Random (whose seeding differs)
- spec 07a: canonical run record; stdout/stderr as UTF-8 strings or
  base64 objects, files always base64 objects
- spec 11 §8: blocked only at global quiescence (no runnable unit, no
  known future event, unfinished execution)
- reserved feature resource_joins; test names are permanent and
  rule-descriptive (renamed resource_*/borrow_* tests)
- plan: remaining Phase 2 order heap/regions -> unsafe -> hosted ->
  reports -> aji.toml
2026-10-04 14:07:54 +03:00

42 lines
1.2 KiB
LLVM

; Golden vector of the deterministic generator (spec 11 §8.1): seed 0, calls of 1, 7, 8 and 17 bytes.
; expect: run
; grant: rng=random.read
; seed: 0
; result: [180,42,69,86,73,120,31,110,224,230,51,73,157,132,95,26,44,45,45,38,241,148,165,106,89,46,132,31,74,173,165,187,202]
; phase: 2
; spec: docs/spec/11-determinism-and-replay.md
module test.random_golden_vector
air 0
lang 0.1
features [arrays, capabilities, effects, ownership]
fn @main(%rng: cap<random.read>) -> array<u8, 33>
effects [random.read]
entry:
%b = local.alloc array<u8, 33>
local.zero %b
%m = borrow.mut %b
%s = slice.make %m
%o0 = const.usize 0
%o1 = const.usize 1
%o8 = const.usize 8
%o16 = const.usize 16
%n7 = const.usize 7
%n17 = const.usize 17
%a = slice.sub %s, %o0, %o1
intrinsic random.fill(%rng, %a)
borrow.end %a
%c = slice.sub %s, %o1, %n7
intrinsic random.fill(%rng, %c)
borrow.end %c
%d = slice.sub %s, %o8, %o8
intrinsic random.fill(%rng, %d)
borrow.end %d
%e = slice.sub %s, %o16, %n17
intrinsic random.fill(%rng, %e)
borrow.end %e
borrow.end %s
borrow.end %m
%r = local.load %b
ret %r