From 58e44f1bb09fbd8bbfe1199acee2baeeb6959037 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20S=C3=A1nchez=20Ram=C3=ADrez?= Date: Fri, 13 Sep 2024 18:17:24 -0400 Subject: [PATCH] Fix `rand` on `TensorNetwork` --- src/TensorNetwork.jl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/TensorNetwork.jl b/src/TensorNetwork.jl index bd470b1c..89b4fdae 100644 --- a/src/TensorNetwork.jl +++ b/src/TensorNetwork.jl @@ -721,6 +721,10 @@ function Base.rand( return TensorNetwork(tensors) end +function Base.rand(::Type{TensorNetwork}, n::Integer, regularity::Integer; kwargs...) + return rand(Random.default_rng(), TensorNetwork, n, regularity; kwargs...) +end + function Serialization.serialize(s::AbstractSerializer, obj::TensorNetwork) Serialization.writetag(s.io, Serialization.OBJECT_TAG) return serialize(s, tensors(obj))