how to make enemies randomly emitted along the axis of X

Greetings to all? Please tell me how to make enemies randomly emitted along the axis of X? May have any examples?
There is such a script, but it is in JavaScript. Please tell me how to convert a C Sharp and do outreach enemies along the X axis from left to right

public var enemy : GameObject;
public var spawnTime : float = 2;

function Start() { 

    InvokeRepeating("addEnemy", spawnTime, spawnTime);
}

// New function to spawn an enemy
function addEnemy() { 

    var x1 = transform.position.x - renderer.bounds.size.x/2;
    var x2 = transform.position.x + renderer.bounds.size.x/2;

    var spawnPoint = new Vector2(Random.Range(x1, x2), transform.position.y);

    Instantiate(enemy, spawnPoint, Quaternion.identity);
}

This is the same script, but in C#…

using UnityEngine;
using System.Collections;

public class Spawner : MonoBehaviour
{
    public GameObject enemy;

    public float spawnTime = 2;

    private Renderer r;

    void Start()
    {
        r = GetComponent<Renderer>();

        InvokeRepeating("addEnemy", spawnTime, spawnTime);
    }

    void addEnemy()
    {
        float x1 = transform.position.x - r.bounds.size.x / 2;
        float x2 = transform.position.x + r.bounds.size.x / 2;
       
        Vector2 spawnPoint = new Vector2(Random.Range(x1, x2), transform.position.y);

        Instantiate(enemy, spawnPoint, Quaternion.identity);
    }
}