Click here to Skip to main content
15,885,949 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
C#
<code></code>

public static class Gaussian
{

public static Random gen =new Random();

public static double GetRandomGaussian()
{
return GetRandomGaussian(0.0,1.0);
}

public static GetRandomGaussian(double mean,double stddev)
{
double rval1,rval2;
GetRandomGaussian(mean,stddev,out rval1,out val2); 
return rval1;
return rval2;

}



What I have tried:

i am getting the error in GetRandomGaussian in the line above return val1
error is method must have a return type
Posted
Updated 6-Dec-17 21:20pm
Comments
Anele Ngqandu 7-Dec-17 3:13am    
Karthik is correct, your GetRandomGaussian(double mean,double stddev) needs to return a double

Quote:
public static GetRandomGaussian(double mean,double stddev)
{
double rval1,rval2;
GetRandomGaussian(mean,stddev,out rval1,out val2);
return rval1;
return rval2;

}
What are you trying to do?
First, a method must have a return type (mark it as void, if nothing should be returned). Then you are trying to call a not existing overload of GetRandomGaussian, taking four arguments.
Finally you are using two sequential return statemets, the latter having NO effect.
What is your target? could you please describe it exactly?
 
Share this answer
 
Comments
Member 13562804 7-Dec-17 4:48am    
yes thank u all for giving answer
i am using void and double return type
...the problem is its creating some different errors
and here am getting problem in .exe creation file
.exe file is not created...and thats the error
add return type[^] to the method
public static double GetRandomGaussian(double mean, double stddev)
 
Share this answer
 
v3
Comments
Member 13562804 7-Dec-17 4:48am    
yes thank u all for giving answer
i am using void and double return type
...the problem is its creating some different errors
and here am getting problem in .exe creation file
.exe file is not created...and thats the error

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900