Re: random number generator help
- From: "Alberto Poblacion" <earthling-quitaestoparacontestar@xxxxxxxxxxxxx>
- Date: Fri, 27 Apr 2007 08:15:39 +0200
"Mike Langworthy" <mcl1982@xxxxxxxxxxx> wrote in message news:ev$sEzIiHHA.1240@xxxxxxxxxxxxxxxxxxxxxxx
i can not seem to get this code to work. someone please help
You are calling an instance method from a static method. It will work if you add the keyword "static" to the instance method:
using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int returnValue = RandomNumber(5, 20);
Console.Write(returnValue);
}
private static int RandomNumber(int min, int max)
{
Random random = new Random();
return random.Next(min, max);
}
}
}
.
- References:
- random number generator help
- From: Mike Langworthy
- random number generator help
- Prev by Date: Creating a very simple report: Crystal Report and SetParameterValue ?
- Next by Date: Re: stringOperand + null = ?
- Previous by thread: random number generator help
- Next by thread: Re: random number generator help
- Index(es):
Relevant Pages
|