Modify Sprite size to reflect parent element

I am trying to randomly place a sprite inside a another square sprite inside a gameObject.

I have the random part working, however I cannot seem to modify the size of the randomly selected sprites. Some are within the bounds of the parent sprite, some are not. My goal is modify the scale so as to have the sprites that exceed the size of the square sprite shrink so that they fit inside the square sprite.

I was looking at transform.localScale because it says it is transformed relative to the parent.

Anyway, here is what I have so far. I commented out my attempt at transform.localscale because it didn’t seem to do anything useful.

using UnityEngine;
using System.Collections;
using System.Collections.Generic;

/************************************************************************
* Class used to randomly show shape sprites in draw area
* 
*
*
************************************************************************/

public class show_shape_MD : MonoBehaviour {
	//providing slots in script for available shape sprites
	public Sprite sprite1; 
	public Sprite sprite2;
	public Sprite sprite3;
	public Sprite sprite4;
	public Sprite sprite5;
	public Sprite sprite6;
	public Sprite sprite7;
	public Sprite sprite8;
	public Sprite sprite9; 
	public Sprite sprite10;
	public Sprite sprite11;
	public Sprite sprite12;
	public Sprite sprite13;
	public Sprite sprite14;
	public Sprite sprite15;
	public Sprite sprite16;
		
	public float width = 500;
	public float height = 500;

	private SpriteRenderer spriteRenderer; 

	void Start ()
	{
		spriteRenderer = GetComponent<SpriteRenderer>();
		if (spriteRenderer.sprite == null)
			spriteRenderer.sprite = sprite1;
	}
	//On mouse down change sprite randomly
	void Update (){
			if (Input.GetMouseButtonDown(0))
		{
			//call to randomly change sprite
			random_Sprite_change ();
		}
	}
	//function to randomly select a sprite
	void random_Sprite_change (){
		Debug.Log ("stepped into sprite change function");
		int randNum = Random.Range (1, 16);
		switch(randNum){
			case 1: spriteRenderer.sprite = sprite1; break;
			case 2: spriteRenderer.sprite = sprite2; break;    
			case 3: spriteRenderer.sprite = sprite3; break;
			case 4: spriteRenderer.sprite = sprite4; break;    
			case 5: spriteRenderer.sprite = sprite5; break;
			case 6: spriteRenderer.sprite = sprite6; break;	
			case 7: spriteRenderer.sprite = sprite7; break;
			case 8: spriteRenderer.sprite = sprite8; break;
			case 9: spriteRenderer.sprite = sprite9; break;
			case 10: spriteRenderer.sprite = sprite10; break;
			case 11: spriteRenderer.sprite = sprite11; break;
			case 12: spriteRenderer.sprite = sprite12; break;    
			case 13: spriteRenderer.sprite = sprite13; break;
			case 14: spriteRenderer.sprite = sprite14; break;    
			case 15: spriteRenderer.sprite = sprite15; break;
			case 16: spriteRenderer.sprite = sprite16; break;
			}
		sprite_scale ();
	}
	//used to scale sprite based on parent sprite size
	void sprite_scale (){
		/*Vector3 scale = new Vector3( width, height, 1f );
		transform.localScale = scale;
		transform.localScale.Equals(spriteRenderer.sprite);*/
		}
}

Please note my scales are not to the size of the parent sprite, I was just making sure I could notice if anything changed.

first i prefer using an array to manage all the sprites

public Sprite[] sprites;

spriteRenderer.sprite = sprites[Random.Range(0,sprites.Length)];

To make it fix in a square, you can use the data from sprite.bounds