i want to make random numbers for x[row][col] that row =10 and col =10, but my problem is: how i fix random numbers of n[col]=5; here is my code: public static void main(String[] args){ double[][] x= new double[10][10]; int row,col; int n[]={0,0,0,0,0,0,0,0,0,0}; for(row=0; row<10; row++ ){ for(col=0; col<10; col++){ if( n[col]==5){ x[row][col]= (double) (Math.random()); System.out.println("x[" + row + "][" + col + "] = " x[row][col]); } } } }

Member Avatar
Member Avatar
+0 forum 6

I have an assignment to make a craps game in c. The program i wrote runs but it always ends before it should. I think that the while loops in main have a problem but im not exactly sure wat the problem is because ive reviewed this code over and over and it seems logical but somehow its not working properly. The loop is supposed to call the play_game function over and over again as long as the input from the user is 'Y' or 'y'. when you run the program the loop is calls the play_game function, outputs an …

Member Avatar
Member Avatar
+0 forum 2

Hi clever people, I need some help making a VB application which chooses a random line for a file, sets it as the value of a Label (word) and also adds it to a ListBox (list) when a Button (nextbut) is pressed. I also want it to keep going. Button; Text: Next Name: nextbut Label; Name: word Listbox;Name: list What i need it to do is to load a line from a file ("C:\words.txt" for example) and set it as the value f the label. The lines are different lenghts. Any hwlp would be highly appreciated

Member Avatar
Member Avatar
+0 forum 1

My problem is, I've just started with C# and i was given a problem to solve by my teacher... here is the code... [CODE] { class Program { static void Main(string[] args) { int[] a = new int[20]; Random rand = new Random(); for (int i = 0; i < 10; i++) a[i] = rand.Next(10000); for (int i = 0; i < 10; i++) Console.WriteLine(a[i]); Console.Read(); } } } [/CODE] Now i have to use a Loop to desplay the number from small to big. The way it is now is the numbers display random between 0-10000 and i was …

Member Avatar
Member Avatar
+0 forum 3

I am new to C# and have encountered a problem with the following if statement... [CODE]measurement = GetRandomInt(0, 2); measurement2 = GetRandomInt(0, 2); if ((measurement == 1) || (measurement2 == 1)) q3correct = 1; else q3correct = 0;[/CODE] The statement works around 80% of the time and i have checked every possible sequence of numbers several times. It seems to happen randomly but occasionally the variable is given the wrong value. Thanks in advance.

Member Avatar
Member Avatar
+0 forum 3

I am using Visual Studio 2010 and C#. I am having problems making my three dice generate different random numbers. All of the dice roll at the same time. I have pictures of dice that I want to pull up for each of 3 dice according to what random number was generated. But when the pictures generate, it is the same picture (aka same number) for all 3 dice. I tried at first to make all three dice pull a random number from the same method, then I tried to make a separate random method for each dice (i.e., randomNum1(), …

Member Avatar
Member Avatar
+0 forum 2

Hi all, I was wondering if someone could help me with this bit of coding. I have set two veriables d1 and d2 to pick a random int of 1 to 10: which I need for in loop but when I run it the same number appear How do I get a differnt verity of numbers during for in loop in Python 3.1.3 please... Thanks for your time. [CODE]# generate random number a certian number of times import random # set vers d1= random.randint(1 ,10) d2= random.randint(1,10) # now print different number 10 times for count in range(1,11): print (d1,d2) …

Member Avatar
Member Avatar
+0 forum 2

Hey, I'm new to Python and wondering about the following bit of code. It tells me that the module random has no attribute randint. I've looked at the documentation and such and I think I'm doing it correctly, but obviously something's wrong. Any ideas? Thanks! [code] import random int1=random.randint(1, 6) int2=random.randint(1, 6) print "Die one was "+str(int1) print "Die two was "+str(int2) print "Your total was "+str(int1+int2) [/code]

Member Avatar
Member Avatar
+0 forum 5

Hello I have a > b(for example) I need to generate random number x that belongs from a to b for example a = 9, b = 16 x has to be x > 9 and x < 16 I use cstdlib.. but can't guess how to do it (using rand()) can you do it, without any while or for?? this is a part of a huge program... so I have to do it carefully, this my program doesn't work.. I think the reason is that... this is a part of my program ... the excercise was about a game …

Member Avatar
Member Avatar
+0 forum 9

The End.