|
kthxbye?
Sorry for 'text speak'!
'As programmers go, I'm fairly social. Which still means I'm a borderline sociopath by normal standards.' Jeff Atwood
|
|
|
|
|
Precisely. Why should we waste our time and energy on such jokers?
Vasudevan Deepak Kumar
Personal Homepage Tech Gossips
The woods are lovely, dark and deep,
But I have promises to keep,
And miles to go before I sleep,
And miles to go before I sleep!
|
|
|
|
|
You got to admit he's good at being a CEO. Who else could turn a blunder into a positive selling point.
"You get that on the big jobs."
|
|
|
|
|
I would bring this up as a potential threat to my business with the powers that be and try to find a different vendor for that type of product.
I wasn't, now I am, then I won't be anymore.
|
|
|
|
|
Here's a little jewel I found in the source code of a module I bought (just changed querystring parameter and variable names)
If Request.QueryString("queryParam") <> Nothing Then
Select Case Convert.ToInt16(Request.QueryString("queryParam"))
Case 1
var = 1
Case 2
var = 2
Case 3
var = 3
Case 4
var = 4
Case 5
var = 5
Case 6
var = 6
End Select
Else
Hopefully the possible values of the parameter won't grow in future
|
|
|
|
|
That's terrible. Where's the default value?
|
|
|
|
|
No, this is not terrible, it's good... it made me laugh!!
|
|
|
|
|
I saw something similar at <a href="http://www.rinkworks.com/stupid/cs_programming.shtml">Computer Stupidities</a> (about halfway down the page). This is worse, though, because one wouldn't expect such atrocities from professionals.
|
|
|
|
|
I'm consider myself far from being a gur at programming, but those things make me cry..
I still have to understand if it's sadness or joy!!
Thank's for the link
|
|
|
|
|
It's VB, what'd you expect?
V.
|
|
|
|
|
I might offend, I'm also a vb guy!!
At least, a I try to be as [C]sharp minded as possible
|
|
|
|
|
Alberto Biasiutti wrote: I'm also a vb guy
Maybe you don't have a choice, in that case you're forgiven as long as you keep that C# minded brain working
V.
|
|
|
|
|
Alberto Biasiutti wrote: I'm also a vb guy!!
We'll.
Speak.
Slowly.
Then.
I worked in VB for about 15 years and I am pleased to have escaped. For now.
Panic, Chaos, Destruction. My work here is done.
Drink. Get drunk. Fall over - P O'H
OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre
I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer
Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett
|
|
|
|
|
Every time I come to CP, I feel dirty because I use VB!
I'll denounce you for discrimination!
|
|
|
|
|
Nagy Vilmos wrote: I worked in VB for about 15 years
That explains the lunchtime drinking...
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Manfred R. Bihy: "Looks as if OP is learning resistant."
|
|
|
|
|
OriginalGriff wrote: That explains the lunchtime drinking.
No, that was the early part of career working in COBOL. VB is responsible for the night time drinking.
Panic, Chaos, Destruction. My work here is done.
Drink. Get drunk. Fall over - P O'H
OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre
I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer
Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett
|
|
|
|
|
I needed a series of random numbers, so I used the following code:
Dim t As Integer = Environment.TickCount
Dim n(9) As Double
For i As Integer = 0 To 9
Dim r As New Random(t)
n(i) = r.Next
Next
You would not believe the facepalm I gave myself when I saw what I did wrong.
|
|
|
|
|
I'm sure you know the err, but some other points:
0. If you need random, use at least two unrelated sources to seed the sequence. I use a combo of ticks from the clock and position of the mouse.
1. Within an application only ever instantiate a single randomiser and do it as the first step of the run.
Panic, Chaos, Destruction. My work here is done.
Drink. Get drunk. Fall over - P O'H
OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre
I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer
Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett
|
|
|
|
|
I know, but there are just some times, especially when constantly interrupted. I usually get one or two of these a week, where I just look at something I did while trying to juggle too many things, and go WTF? Something basic, that I learned in high school, and I just space out or something.
At least it always provides some comic relief later. And I usually need it
|
|
|
|
|
Why bother passing in a custom seed if you don't need one anyhow?
The default constructor of random seeds itself appropriately
|
|
|
|
|
Are all the numbers the same? At least that would make it a lot easier to find.
|
|
|
|
|
I usually just use this[^] when I need random numbers.
|
|
|
|
|
Do you work for Sony, by any chance?
|
|
|
|
|
That was my first thought when I saw the post. The only difference is that he needs to roll the dice 9 times .
|
|
|
|
|
Don't be too hard on yourself. Most people never realize what the 'pseudo' in 'pseudo random number generator' is about. Just turn things around and it may even come in handy at times.
Do you remember the old game Elite? The game had about five galaxies with 256 star systems each. Each system had its own coordinates, a description of the planet and inhabitants and individual prices and stocks for all goods. A good old C64 would have to sacrifice a good part of its tiny memory to store all that.
I'm quite sure they did not. For example, you might generate a hashcode from the coordinates of a system. Then you initialize a random number generator with this hash code and use it to randomly generate the parameters of that system. Since the hashcode will always be the same for that system, the result will be the same every time and can be recreated at will. This completely eliminates the need to store any of the static information. Just the things which are variable, like the current stocks, need to be stored.
For a 'small' game I'm working on I have made a star map with 4 billiion universes with up to 4 billion galaxies, each with 4 billion x 4 billion x 4 billion coordinate points. Each coordinate point has a chance to contain a solar system, each with one or more stars of different types, a variable number of planets of many types and the planets may also have moons. Memory or storage costs: The XML configuration files to work out a convincing star system.
"Dark the dark side is. Very dark..." - Yoda
--- "Shut up, Yoda, and just make yourself another toast." - Obi Wan Kenobi
modified on Wednesday, September 14, 2011 9:43 AM
|
|
|
|