Random # Generator

  • Thread starter TheDemx27
  • Start date
  • #1
TheDemx27
Gold Member
170
13
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        public class RandomNextDemo
        {
            static void NoBoundsRandoms(int seed)
            {
                Console.WriteLine(
                    "\nRandom object, seed = {0}, no bounds:", seed);
                Random randObj = new Random (seed);
            }
        }
        
        static void Main(string[] args)
        {
            RandomNextDemo.NoBoundsRandoms();

        }  
    }
}
Error1'ConsoleApplication1.Program.RandomNextDemo.NoBoundsRandoms(int)' is inaccessible due to its protection

In C#, of course.
 

Answers and Replies

  • #2
268
4
Change the access modifier: static public void NoBoundsRandoms(int seed) by default it would set the access modifier to private which is what your current code does.
 
Last edited:
  • #3
TheDemx27
Gold Member
170
13
Change the access modifier: static public void NoBoundsRandoms(int seed) by default it would set the access modifier to private which is what your current code does.
Thanks, I guess I also forgot to give the method the value "seed" it called for.
 

Related Threads on Random # Generator

  • Last Post
Replies
4
Views
2K
  • Last Post
Replies
1
Views
4K
  • Last Post
Replies
7
Views
3K
  • Last Post
Replies
1
Views
7K
Replies
9
Views
1K
  • Last Post
Replies
1
Views
3K
  • Last Post
Replies
3
Views
4K
Replies
2
Views
3K
Replies
1
Views
3K
Replies
14
Views
5K
Top