Saturday, March 21, 2020
Simulate a Dice Roll With C Code
Simulate a Dice Roll With C Code This application uses the srand() function to seed the random number generator. The function Random(n) returns an integer in the range of 1 to n. The int array totals holds the total counts for the scores 3 to 18. It then loops 10 million times. This number is defined as a const but if your compiler doesnt support const, uncomment the #define instead. Each dice, d1, d2 and d3 holds the Random() generated dice roll die roll and the element for the combined dice score (in the range 3-18) is incremented. The last part prints out the totals to see that it generates throws in accordance with the probabilities. A 6 sided dice has an average score of 3.5, so three dice should average about 10.5. The totals for 10 and 11 are roughly the same and occur about 12.5% of the time. Here is the output of a typical run. It takes no more than a second. Rolling Ten Million Dice 3 461304 1386085 2772786 4626077 6953818 9720209 115834710 125367111 124926712 115648013 97200514 69287415 46245216 27757517 13914218 46163 // dicerolls.c :#include time.h /* Needed just for srand seed */#include stdlib.h#include stdio.hconst tenmillion 1000000L;/* #define tenmillion 10000000L */void Randomize() {srand( (unsigned)time( NULL ) ) ;}int Random(int Max) {return ( rand() % Max) 1;}int main(int argc, char* argv[]){int i;int totals[19];printf(Rolling Ten Million Dice\n) ;Randomize() ;for (i3;i18;i)totals[ i ]0;for (i0;i tenmillion;i){int d1Random(6) ;int d2Random(6) ;int d3Random(6) ;int totald1d2d3;totals[ total ];}for (i3;i18;i){printf(%i %i\n\r,i,totals[ i ]) ;}return 0;}
Thursday, March 5, 2020
7 Body Language Tricks For Nailing Your Job Interview
7 Body Language Tricks For Nailing Your Job Interview In a phone interview, you could be wearing your favorite pajamas while kicking back in your easy chair- no one would be the wiser. However, in an in-person interview, your demeanor is part of the package. Your interviewer is evaluating you just as much as your resume and your answers, so being aware of what youââ¬â¢re putting across is an essential part of interview prep. Here are 7 body language strategies to help you keep calm under the hot lights of interview scrutiny and project your best self.à 1. Stretch it out.When youââ¬â¢re getting dressed and ready to go, take a few minutes to stretch your muscles and do some deep breathing. If youââ¬â¢re like me and have jitters before every interview, no matter how prepared you feel, this can help your mind focus and de-stress. The stretching keeps your muscles from being too tense when you get to the interview, which might make youà come off as stiff and awkward.à 2. Smile! Youââ¬â¢re on stage.When you arrive, be sure t o smile at whoever greets you first and at your interviewer(s). If you feel like your toothiest grin is pasted to your face, maybe dial it back a bit. Itââ¬â¢s okay to show a little bit of teeth (it makes the smile seem more genuine), but no one feels reassured by a mouth full of bared teeth- that one goes back all the way to our prehistoric ancestors. Also make sure youââ¬â¢re involving your eyes: studies have shown that crinkling your eyes up just a little has a warm and welcoming effect to the recipient. Try to have a polite, easy smile for everyone you meet; it shows youââ¬â¢re happy to be there and enthusiastic about the opportunity.à 3. Your handshake brings all the boys to the yard.via [zimbio.com]According to 30 Rockââ¬â¢s Jack Donaghy (Alec Baldwin), ââ¬Å"handshakefulnessâ⬠is one of the pillars of business achievement. And while you may not want to base your career strategies around Liz Lemon and company, Jack is right. Your handshake matters! It shoul d be medium-firm (no death grip to show how strong you are, sorry), with eye contact between you and the shake-ee. Too strong, and you come off as aggressive. Too weak, and you seem nervous and unconfident.à 4. Listen to your momââ¬â¢s advice: donââ¬â¢t slouch.Weââ¬â¢ve become pretty casual as a society, whichà often extends to the workplace. Relaxed dress codes and flexible work arrangements are common these days. But in an interview, while you donââ¬â¢t want to be stiff and awkward, you should definitely err on the side of formality. Always sit up as straight as you can, with shoulders lowered and squared. You might have heard that pushing your shoulders back is the best way to approach posture in an important setting- but that can often have the effect of thrusting out your chest, which can seem provocative or confrontational.à 5. Keep those limbs loose.As for your arms, those can be awkward. Should you hold them straight and rigid at your side at all times? (No pe.) Gesture wildly to illustrate every point? (Try again.) Keep them bent slightly at the elbow and resting gently at your sides? (Bingo.) If it feels awkward keeping your arms down or youââ¬â¢re prone to fidgeting, clasp your hands loosely in front of you, either in your lap or on the table. Itââ¬â¢s important to stay loose, because seeming too tightly coiled can make you look small and retreating. Too loose, and it seems like youââ¬â¢re not taking the interview seriously. The best bet is to adjust your arms as the conversation ebbs and flows, but have the default position be resting casually at your sides.For legs, crossed confidently at the knee is the way to go. If you cross your legs at the ankles, that can give your lower half a downward slope and ruin the good work youââ¬â¢ve done with your overall posture.à 6. Keep your head up.If you have relaxed, confident body language below the neck, youââ¬â¢ll want to make sure your head is in the game as well. As with the arms and sitting posture, donââ¬â¢t tighten up too much and stare straight ahead. The most professional-seeming head posture is keeping your chin tilted slightly sideways and up. This makes it look like youââ¬â¢re listening (which, ideally, you are), and that youââ¬â¢re confident but not aggressive. Tilting your chin straight up and out can look like youââ¬â¢re challenging the interviewer or reacting stubbornly.Also, know ahead of time whether youââ¬â¢re prone to unconscious facial tics like blinking too much when youââ¬â¢re nervous or licking your lips. Practice interview questions in the mirror, and try to keep those habits under control as youââ¬â¢re speaking. These can undermine your confident image.à 7. Sound as good as you look.When youââ¬â¢re preparing for your interview, practice your ââ¬Å"interview voice.â⬠This probably isnââ¬â¢t the time to demonstrate the new British accent youââ¬â¢ve been working on, but rather an extra-steady version of your regular voice. Try smiling slightly when you talk- it gives your voice an open, confident quality. Even if youââ¬â¢re nervous, try not to let your voice waver or decrease in volume- that undermines the self-assured vibe youââ¬â¢re trying to convey.Taking the time to practice these beforehand will make them so much easier to achieve when it comes time for the interview. You know youââ¬â¢re ready to rock this opportunityâ⬠¦ donââ¬â¢t let your body slow you down!
Subscribe to:
Comments (Atom)