|
Post by wascalwywabbit on Jan 9, 2017 14:44:43 GMT -5
I don't care about good\bad habit coding ideas because it varies depending on the language. Have to remember BASIC was created in 1964, I started in the late 80's. Lots has change since then. There's no such thing as bad code if your program does what it's suppose to. Did it look something like this garbage pseudocode? GOTO [yourroom] [yourroom] printscreen "Think about what you did." END
|
|
|
Post by Cory Trese on Jan 9, 2017 14:59:10 GMT -5
|
|
|
Post by wascalwywabbit on Jan 9, 2017 15:01:10 GMT -5
The title of this thread should be ... "only programmers shell understand" What the shell do I know? Makes me wanna Bash my head against the keyboard... A good shell lacking... She sells cshells...
|
|
|
Post by stratego on Jan 9, 2017 15:28:51 GMT -5
The title of this thread should be ... "only programmers shell understand" You are that much right that I changed it😈
|
|
|
Post by stratego on Jan 9, 2017 15:32:03 GMT -5
Just use java: Implement Random randomNum = minimum + (int)(Math.random() * maximum); System.Out.Print(randomNum) Lol I know no {}😈
|
|
|
Post by Cory Trese on Jan 9, 2017 15:36:15 GMT -5
Problem #1 ... Java. Solution: Don't use Java.
|
|
|
Post by stratego on Jan 9, 2017 15:41:14 GMT -5
Problem #1 ... Java. Solution: Don't use Java. I like to use it for learning"logics" althrou java and logics isn't exactly xeno
|
|
|
Post by stratego on Jan 9, 2017 15:43:59 GMT -5
Windows shell rule number 1. You don't use Windows. What's number 2 you may ask, it's don't use anything that doesn't have a LINUX kernel.
|
|
|
Post by amongstshadows on Jan 9, 2017 23:52:08 GMT -5
Cory Trese what do you think is better: Modulus operator? Or Random number engine? Or is there some other way that has eluded me lol
|
|
|
Post by wascalwywabbit on Jan 10, 2017 0:15:40 GMT -5
Cory Trese what do you think is better: Modulus operator? Or Random number engine? Or is there some other way that has eluded me lol Depends on what your purpose is I imagine, white noise/security/encryption engine systems, particularly hardware is best if scientific. If it's for general users, modulating/weighting toward the expected distribution after 100+ iterations is often seen as fair - obviously that requires maintaining of distribution table(s) of prior occurrences. Nobody who wants the mere -appearance- of random wants to see 600 of 1000 coins flips of one side, when the expected is less than 550 for example, even though 600/1000 would be expected sometimes for many large sets of 1000 flips - non-mathematicians don't want perfectly random so much as balanced/fair with some unpredictability.
|
|
|
Post by amongstshadows on Jan 10, 2017 1:17:24 GMT -5
wascalwywabbit For videogame design. I've only used the random number engine one time, and it was for a tutorial
|
|
|
Post by amongstshadows on Jan 10, 2017 1:26:12 GMT -5
Cin.get() good at programming should be our slogan lol
|
|
|
Post by wascalwywabbit on Jan 10, 2017 2:39:47 GMT -5
wascalwywabbit For videogame design. I've only used the random number engine one time, and it was for a tutorial As I said, laymen want fair pseudo random, not true random. E.g. a random number 1-10 will repeat any 1 of the 10 numbers 10% of the time. It will repeat 3x in a row 1%, 4x 0.1% etc. Even if an individual sees 10,000 occurences of that rng run, and statistically should see ~1 occurence of the same number 5x in a row +~ 9 of 4 +~ 90 of three and ~900 of 2, those duplicates, especially greater than 2 repeats will seem unfair and unrandom glitches, particularly if not in their favor. Most people, at least here in the US are terrible at statistics due to lack of rigorous education in the matter. Probability is more commonly taught now, but rigor isn't always there atm. So having each number of 1-10 appear once in ten rngs seems random since they're looking for the whole set to appear in an unpredictable order rather than applying the math to figure out the actual real random expected result, even though it'd typically require 11+ rolls to achieve all 10 in practice. They're certainly not plotting graphs, with a few pedant exceptions. Although strategy games do gather the more math minded oft times compared to some genres. Ways to combat the sense of unfairness includes things like removing a number from the rng range if it has appeared 2-3 times in a row and/or taking out the most common numbers in the last 20 (most short term memories are not good past 20), 50 or 100 rolls etc. Possibly having a hit% (counters for each) of each number in the range, and forcing the lowest rolled% every dozen rolls or so etc. Of course larger ranges are easier to get by with true random since repeats will be less frequent.
|
|
|
Post by amongstshadows on Jan 10, 2017 2:56:29 GMT -5
wascalwywabbit as I understand, very few compilers can even use the true random engine. They will simply call from the pseudo random charts anyways. Since most of my random number needs are for chance rolls with enemy AI, I would rather it be an even chance for every outcome. And according to the cplusplus website, using uniform distribution generators are meant for wanting an equal chance for every number. I wonder if it's looked down upon to use both the modulus operator and the random engine together because I feel the modulus operator would work better for damage calculation. Then again using it to generate a random number from 11-20 isn't always the best idea. Maybe I'll include my own chart in the program, that will call a number based on the number generated
|
|
|
Post by stratego on Jan 10, 2017 12:20:52 GMT -5
|
|