TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Marz Nova
NA
4
477
C# Looping through array bug (NEWBIE)
Feb 2 2018 1:09 PM
I can't figure out why this works if I step through it but when I run it, it will only give me a result such as :
4
4
4
4
4
4
4
4
4
4
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Text;
using
System.Threading.Tasks;
namespace
ConsoleApplication1
{
class
Program
{
public
static
int
diceRoller(
int
x,
int
y)
{
Random rnd =
new
Random();
int
result = rnd.Next(x, y+1);
return
result;
}
static
void
Main(
string
[] args)
{
int
[] myArray =
new
int
[10];
for
(
int
i = 0; i < myArray.Length; i++)
{
myArray[i] = diceRoller(1, 6);
Console.WriteLine(myArray[i]);
}
Console.ReadKey();
}
}
}
Reply
Answers (
1
)
google calendar API
How to open a existing workbook in editable mode in c#