// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0.
// SPDX-License-Identifier: MPL-2.0
import "../_dnt.polyfills.js";
import * as t from "../types.js";
import { runtimes } from "../wit.js";
import { Runtime } from "./mod.js";
import { fx } from "../index.js";
export class RandomRuntime extends Runtime {
    constructor(data) {
        super(runtimes.registerRandomRuntime(data));
    }
    /** create a function for random value generation */
    gen(out) {
        const effect = fx.read();
        const matId = runtimes.createRandomMat({
            runtime: this._id,
            effect,
        }, {
            runtime: this._id,
        });
        return t.func(t.struct({}), out, {
            _id: matId,
            runtime: this._id,
        });
    }
}
