My sprite doesn't render on scene view and game view

I’m trying to make a code to generate a random sprite to put on a face id (Papers please style) when I press R, but it doesn’t appear on scene view and the game view when the game is running. If it’s not running, the sprite appears normally. And it’s not the layer because I checked.
Here’s the code I wrote:

public class Paper : MonoBehaviour
{
    public Sprite[] suits;

    public SpriteRenderer suitRenderer;
    public Sprite suit;

    private void Update()
    {
        if (Input.GetKeyDown(KeyCode.R))
        {
            generatePaper();
        }
        suitRenderer.sprite = suit;
    }

    public void generatePaper()
    {
        suit = suits[Random.Range(0, suits.Length)];
    }
}

An image of what’s happening.

Hi, I copied your code and it worked. Only if you don´t set the start suit, no sprite will be rendered at the start. But after the first time I generated a suit there where no cases, in which it didn´t show up. So the problem needs to be some were else.
To determine what the problem is I would need more information.

Remember to asign a sprite at the beginning for the sprite to be shown at the start. After that make sure that your suits array has more than 0 sprites in it. And that you also press R on your keyboards.