i need help with a random number health script

hey i need help with my healt script it has to do random damage but it doesen’t work so pleas help me . Here is my code

`#pragma strict
var health : int = 100;
static var seed : int ;
var myDouble : float = 100;
function Start () {
health -= myDouble;
}

function damage () {

myDouble = (Random.Range(1, 300) == 1 ? -0.1 : -0.3);

}`

Is that the whole script? How are you calling the damage function?

You subtract myDouble from health at startup and then you assign myDouble a new value on damage…that doesn’t make much sense…or I don’t see it.

I would do something like this:

var health : float = 100.0;

function damage() {
    health -= Random.Range(1, 300) == 1 ? 0.1 : 0.3;
}

hey thanks for your awnser i am new so i dident know how to do randomize numbers