
this might look silly but i ve created a simple "random numbers generator" based on the DateTime class
double time = DateTime.Now.Millisecond;
double randomnumber = time / 1000;
Console.WriteLine("random is :{0}",randomnumber.ToString());
what do u think pretty strong huh ??





Good enough for some purposes... I suppose.






Then at least eliminate a step:
double time = DateTime.Now.Millisecond / 1000.0 ;





So I have a project that I've been working on, its a simple form that takes some input, then formats the text on a Word document. I've come close to being able to format the text in a pyramid shape, but it fails when the text is not precanned to fit in that shape.
Precanned text might contain 4 paragraphs, with each paragraph containing more text than the previous. This has been fairly easy to set using constant values for right & left gutters, margins and so forth.
Noncanned text is unknown, might have 2 paragraphs, might have 8 paragraphs and the first one containing more than the 3rd but less than the 5th. Its completely unknown.
I've searched google and did not find an answer.
Question: Is there a formula that can be used to format an unknown amount of text into a pyramid shape?
Thanks
Just because we can; does not mean we should.





One approach:
1. Put all the text into an array of words (assuming you don't want to split words to fit the pyramid).
2. Write a function that takes a row number and gives the width of the pyramid at that row. (This will depend on the vertex angle of your pyramid.)
3. For each row, construct a string out of the next words that haven't been used yet that minimizes the difference between the string length and that pyramid row width. (It could go over or under the row width.)
4. Center this string at the pyramid row.
5. Repeat until all the words have been used.





How to find Inverse of NORMSDIST function
ie NORMSINV
It Returns the inverse of the standard normal cumulative distribution. The distribution has a mean of zero and a standard deviation of one.
Syntax
double NORMSINV(double probability)
Probability is a probability corresponding to the normal distribution.






thanks 4 reply
But I m not getting exact answer when i match my answer from ms excel





No, that's not what is meant by "inverse". It's the inverse distribution function he's looking for.
I'm the ocean. I'm a giant undertow.





You should check out http://www.google.com.au/codesearch[^] first when you have a well known function that you want, I had a quick check and there seems to be implementations there.
Peter
"Until the invention of the computer, the machine gun was the device that enabled humans to make the most mistakes in the smallest amount of time."





I Didn't see any implementations there. If u have seen any then plz provide some link.





There are multiple implementations there  it is really in your interest to learn how to search for them. I bet you simply typed in "NORMSINV" and just got lots of references to uses of the function, gave up and came back here. You have to be a little creative and try to make the search engine find function definitions. I went to the same page and with my next search came up with several implementations.
Peter
"Until the invention of the computer, the machine gun was the device that enabled humans to make the most mistakes in the smallest amount of time."





The inverse CDF of the normal distribution doesn't have an analytical form. You can find an approximation here[^].
The other place to look is in the online version of Numerical Recipes[^]. They have an algorithm for the inverse normal CDF.
You can also use the following taken from here[^].
What is a good approximation to the inverse of the
cumulative normal distribution function? Mathematically we can
write this as: Find X such that Q(X) = p for any 0 < p < 1.
(Note: this computes an upper tail probability.) Again, it is
not possible to write this as a closed form expression, so we
resort to approximations. Because of the symmetry of the normal distribution,
we need only consider 0 < p < 0.5. If you
have p > 0.5, then apply the algorithm below to q = 1p,
and then negate the value for X obtained. (This approximation
is also from Abramowitz and Stegun.)
t = sqrt[ ln(1/p^2) ]
c_0 + c_1*t + c_2*t^2
X = t  
1 + d_1*t + d_2*t^2 + d_3*t^3
c_0 = 2.515517
c_1 = 0.802853
c_2 = 0.010328
d_1 = 1.432788
d_2 = 0.189269
d_3 = 0.001308
See Abramowitz and Stegun; Press, et al.
You should Google a little harder instead of always asking here. These algorithms were worked out a long time ago and have been available for a long time.
I'm the ocean. I'm a giant undertow.





73Zeppelin wrote: You should Google a little harder instead of always asking here
I think it is more of a case of sheer laziness. He's asking about the FDIST function now, and I pointed him to Wolfram's Mathworld.
"The clue train passed his station without stopping."  John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks"  Pete O'Hanlon





How to find NORMSDIST function of ms excel.It Returns the standard normal cumulative distribution function. The distribution has a mean of 0 (zero) and a standard deviation of one. Use this function in place of a table of standard normal curve areas.
Syntax
NORMSDIST(z)
Z is the value for which you want the distribution.
Thanks





drinking beer is a wonderful experience.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
 Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
 Iain Clarke
[My articles]






Don't you agree on beer drinking statement?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
 Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
 Iain Clarke
[My articles]





No
If u know the answer plz tell me..





How can I answer if there is NO question?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
 Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
 Iain Clarke
[My articles]





i want to make function to calculate Normsdist like this:
Public Function calculateNormsdist(ByVal z As Single) As Single
and it will give the answer
can u implement it??





sumit7034 wrote: can u implement it??
yes
Peter
"Until the invention of the computer, the machine gun was the device that enabled humans to make the most mistakes in the smallest amount of time."





sumit7034 wrote: can u implement it??
cp9876 wrote: yes
I was pretty sure about.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
 Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
 Iain Clarke
[My articles]





plz implement it



