Hashtron inference: Difference between revisions
m
→{{header|Phix}}: (hmpf)
m (→{{header|Phix}}: mior tidy) |
m (→{{header|Phix}}: (hmpf)) |
||
Line 328:
function hashtron(integer n, s, mx)
// Mixing stage, mix input with salt using subtraction
atom m =
// Hashing stage, use xor shift with prime coefficients
for p in {-2,-3,+5,+7,-11,-13,+17,-19} do
m = xor_bitsu(m,
end for
// Mixing stage 2, mix input with salt using addition
m =
// Modular stage using Lemire's fast alternative to modulo reduction
Line 342:
end function
function inference(integer
atom out = 0
if length(program) then
for j=0 to bits-1 do
integer {ss, maxx} = program[1],
input = hashtron(
for p in program from 2 do
end for
if odd(input) then
|