def METHOD_NAME(shape, generator=None):
    """Generate a tensor with random numbers from a normal distribution using the previously initialized genrator.
    Use either randn() or manual_seed() to initialize the generator."""
    if shared.opts.randn_source == "NV":
        return torch.asarray((generator or nv_rng).randn(shape), device=devices.device)
    if shared.opts.randn_source == "CPU" or devices.device.type == 'mps':
        return torch.randn(shape, device=devices.cpu, generator=generator).to(devices.device)
    return torch.randn(shape, device=devices.device, generator=generator)