473,890 Members | 1,381 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

rolling dice

Let's say I have m dice having n sides, such that n^m is not going to bust
int as a datatype. With m=4 and n=6, an outcome might be {2, 5, 1, 2}.
What is a good way to represent this in c so that I can check cases by brute
force? EC
Sep 30 '06
101 6450
Frederick Gotham <fg*******@SPAM .comwrites:
[...]
They have enough money to stop focusing on business, and start focusing on
what they actually would like to do. Bill Gates gives millions (if not
billions) to charity every year.

If they're greedy enough to write non-portable code for the sake of non-
portable code, you'd wouldn't expect them to be giving money to charity...
Bill Gates is not Microsoft. Bill Gates is an individual, who can do
whatever he likes with his own money. Microsoft is a business with a
fiduciary responsibility to its shareholders.

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Oct 7 '06 #41
Keith Thompson posted:
Bill Gates is not Microsoft. Bill Gates is an individual, who can do
whatever he likes with his own money. Microsoft is a business with a
fiduciary responsibility to its shareholders.

Hmm... I think I just don't like business fullstop -- seems to do more harm
than good (except for giving you money and all that malarky...).

--

Frederick Gotham
Oct 7 '06 #42
"Frederick Gotham" <fg*******@SPAM .comwrote in message
>
I don't think it would hurt for Microsoft to send their programmers on a
one-
day course about portable programming. It would only take a matter of
hours
to get them using things like the following:

struct MyStruct obj = {0};
Which doesn't make it entirely obvious that the programmer's intent is to
initialise all elements to zero. Particularly if the reader isn't very
familiar with C.

I'm not saying you are wrong to say that your way is better. However the
matter isn't entirely clear cut.

--
www.personal.leeds.ac.uk/~bgy1mm
freeware games to download.
Oct 8 '06 #43

"Keith Thompson" <ks***@mib.orgw rote in message
news:ln******** ****@nuthaus.mi b.org...
Frederick Gotham <fg*******@SPAM .comwrites:
[...]
They have enough money to stop focusing on business, and start focusing
on
what they actually would like to do. Bill Gates gives millions (if not
billions) to charity every year.

If they're greedy enough to write non-portable code for the sake of non-
portable code, you'd wouldn't expect them to be giving money to
charity...
>
Bill Gates is not Microsoft. Bill Gates is an individual, who can do
whatever he likes with his own money.
True.
Microsoft is a business with a
fiduciary responsibility to its shareholders.
That's the theory, but it is not true in reality for any of the Fortune 500.
The reason is mutual funds. Ballmer is CEO. Gates is on the Board of
Directors. 14% of Microsoft stock is controlled by Gates and Ballmer.
(Interesting, Paul Allen isn't anywhere to be found in the ownership of
stock.) 67% of Microsoft is owned by Mutual funds. They own voting stock.
Three years after SEC rules to force mutual funds to reveal proxy votes, the
largest mutual funds vote in favor of management 95% of the time with the
industry as a whole voting in favor of management 74% of the time. (I would
assume 100% before July 2003 based on past Forbes articles...)
http://money.cnn.com/2006/03/28/news..._votes_ceopay/

NASDAQ's stock market (electronic transactions) caters to technology firms
which don't usually pay dividends. Also, it doesn't allow the short sales
of securities. On NYSE, a stock exchange, a stock's price can be driven
down by two forces: selling and shorting. It can be driven up (or held up)
by two forces: buying and dividends. Short selling and dividends help to
correct imbalances, usually short term, that aren't percieved or are ignored
by certain investors, usually long term. Unfortunately, a problem arises
when a NASDAQ security, like MSFT, begins paying a dividend. When the
buyers and sellers are roughly in balance, the dividend attracts more buyers
which upholds a certain price, but there is no counterbalancin g force to
drive the price of the stock down if others recognize that it is actually
underperforming (i.e., no short selling). This creates an upward price
distortion on NASDAQ for dividend paying securities. Of course, the usual
method on NYSE to wrest corporate control from incompetent management is to
drive the stock price down by selling and shorting until it is delisted.
Without short selling, it is harder to delist a dividend paying NASDAQ
security. This insulates underperforming management from change. Due to
this, if MSFT was a NYSE security, it's value would be lower.

You could also study how Kerk Kerkorian, KKR, Leon Black, or Ronald
Perelman, etc. get control with small percentages of ownership.
Rod Pemberton
Oct 8 '06 #44
"Rod Pemberton" <do*********@bi tfoad.cmmwrote in message
>
"Keith Thompson" <ks***@mib.orgw rote in message
news:ln******** ****@nuthaus.mi b.org...
>Frederick Gotham <fg*******@SPAM .comwrites:
[...]
They have enough money to stop focusing on business, and start focusing
on
what they actually would like to do. Bill Gates gives millions (if not
billions) to charity every year.

If they're greedy enough to write non-portable code for the sake of
non-
portable code, you'd wouldn't expect them to be giving money to
charity...
>>
Bill Gates is not Microsoft. Bill Gates is an individual, who can do
whatever he likes with his own money.

True.
>Microsoft is a business with a
fiduciary responsibility to its shareholders.

That's the theory, but it is not true in reality for any of the Fortune
500.
The reason is mutual funds. Ballmer is CEO. Gates is on the Board of
Directors. 14% of Microsoft stock is controlled by Gates and Ballmer.
(Interesting, Paul Allen isn't anywhere to be found in the ownership of
stock.) 67% of Microsoft is owned by Mutual funds. They own voting
stock.
Three years after SEC rules to force mutual funds to reveal proxy votes,
the
largest mutual funds vote in favor of management 95% of the time with the
industry as a whole voting in favor of management 74% of the time. (I
would
assume 100% before July 2003 based on past Forbes articles...)
http://money.cnn.com/2006/03/28/news..._votes_ceopay/

NASDAQ's stock market (electronic transactions) caters to technology firms
which don't usually pay dividends. Also, it doesn't allow the short sales
of securities. On NYSE, a stock exchange, a stock's price can be driven
down by two forces: selling and shorting. It can be driven up (or held
up)
by two forces: buying and dividends. Short selling and dividends help to
correct imbalances, usually short term, that aren't percieved or are
ignored
by certain investors, usually long term. Unfortunately, a problem arises
when a NASDAQ security, like MSFT, begins paying a dividend. When the
buyers and sellers are roughly in balance, the dividend attracts more
buyers
which upholds a certain price, but there is no counterbalancin g force to
drive the price of the stock down if others recognize that it is actually
underperforming (i.e., no short selling). This creates an upward price
distortion on NASDAQ for dividend paying securities. Of course, the usual
method on NYSE to wrest corporate control from incompetent management is
to
drive the stock price down by selling and shorting until it is delisted.
Without short selling, it is harder to delist a dividend paying NASDAQ
security. This insulates underperforming management from change. Due to
this, if MSFT was a NYSE security, it's value would be lower.

You could also study how Kerk Kerkorian, KKR, Leon Black, or Ronald
Perelman, etc. get control with small percentages of ownership.
How boring.
To think that some people read this sort of stuff for a living.
--
www.personal.leeds.ac.uk/~bgy1mm
freeware games to download.
Oct 8 '06 #45
"Malcolm" <re*******@btin ternet.comwrite s:
"Frederick Gotham" <fg*******@SPAM .comwrote in message
>I don't think it would hurt for Microsoft to send their programmers
on a one- day course about portable programming. It would only take
a matter of hours to get them using things like the following:

struct MyStruct obj = {0};
Which doesn't make it entirely obvious that the programmer's intent is to
initialise all elements to zero. Particularly if the reader isn't very
familiar with C.

I'm not saying you are wrong to say that your way is better. However the
matter isn't entirely clear cut.
To a reader who isn't familiar with C, *nothing* in a C program is
goig to be entirely obvious.

It's obvious to me that "= {0}" initializes all elements to zero, and
it should now be obvious to everyone who reads this thread. I don't
know how widespread this idiom is, but IMHO it's a good one.

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Oct 8 '06 #46

"Keith Thompson" <ks***@mib.orgw rote in message
news:ln******** ****@nuthaus.mi b.org...
"Malcolm" <re*******@btin ternet.comwrite s:
>"Frederick Gotham" <fg*******@SPAM .comwrote in message
>>I don't think it would hurt for Microsoft to send their programmers
on a one- day course about portable programming. It would only take
a matter of hours to get them using things like the following:

struct MyStruct obj = {0};
Which doesn't make it entirely obvious that the programmer's intent is to
initialise all elements to zero. Particularly if the reader isn't very
familiar with C.

I'm not saying you are wrong to say that your way is better. However the
matter isn't entirely clear cut.

To a reader who isn't familiar with C, *nothing* in a C program is
goig to be entirely obvious.

It's obvious to me that "= {0}" initializes all elements to zero, and
it should now be obvious to everyone who reads this thread. I don't
know how widespread this idiom is, but IMHO it's a good one.
Thats not true.
Show a Fortran programmer

x = x + y;

and he'll have no problem.

i++;

is pretty intutive to anyone bit a bit of common sense.

*ptr++ = x;

on the other hand is rather tricky. Its idiomatic and something you really
have to learn when writing C.

for(i=0; i < y, z; )

is perfectly good C, but the sort of construct that you hardly ever
encounter, and extremely likely to confuse. So there is a good case for
avoiding code like this.

str = {0};

you can argue either way. You could say that it is common and useful enough
to say that every reader must know it, or you could say that it is
confusing.
--
www.personal.leeds.ac.uk/~bgy1mm
freeware games to download.
Oct 8 '06 #47
"Malcolm" <re*******@btin ternet.comwrite s:
"Keith Thompson" <ks***@mib.orgw rote in message
news:ln******** ****@nuthaus.mi b.org...
>"Malcolm" <re*******@btin ternet.comwrite s:
>>"Frederick Gotham" <fg*******@SPAM .comwrote in message
I don't think it would hurt for Microsoft to send their programmers
on a one- day course about portable programming. It would only take
a matter of hours to get them using things like the following:

struct MyStruct obj = {0};

Which doesn't make it entirely obvious that the programmer's intent is to
initialise all elements to zero. Particularly if the reader isn't very
familiar with C.

I'm not saying you are wrong to say that your way is better. However the
matter isn't entirely clear cut.

To a reader who isn't familiar with C, *nothing* in a C program is
goig to be entirely obvious.

It's obvious to me that "= {0}" initializes all elements to zero, and
it should now be obvious to everyone who reads this thread. I don't
know how widespread this idiom is, but IMHO it's a good one.
Thats not true.
Show a Fortran programmer

x = x + y;

and he'll have no problem.

i++;

is pretty intutive to anyone bit a bit of common sense.

*ptr++ = x;

on the other hand is rather tricky. Its idiomatic and something you really
have to learn when writing C.

for(i=0; i < y, z; )

is perfectly good C, but the sort of construct that you hardly ever
encounter, and extremely likely to confuse.
Ok, I'm with you so far.
So there is a good case for
avoiding code like this.

str = {0};

you can argue either way. You could say that it is common and useful enough
to say that every reader must know it, or you could say that it is
confusing.
But I fail to see how you reach your conclusion about {0}.

An initializer of {0} is guaranteed to initialize all components of
the object to zero, converted to the appropriate type, recursively for
aggregates within aggregates. It's difficult to understand if you
don't happen to know this, but very easy to understand if you do
(e.g., for anyone who has read this thread).

And there is, as far as I know, no good alternative. You can declare
a static object with no initializer, and it achieves much the same
effect, but it's much less explicit.

It's simple, and it's clear once you understand it. I don't
understand why you think it should be avoided.

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Oct 8 '06 #48
"Malcolm" <re*******@btin ternet.comwrote :
"Frederick Gotham" <fg*******@SPAM .comwrote in message
And once again, the rule of thumb applies:

Don't do what Microsoft does.
People who know a lot about computers often like to make jokes at the
expense of Bill Gates and his software company.
Don't let that fool you into thinking that these reflect their real opinions
about Microsoft.
On the contrary, my statements about MS reflect my opinion of them fine.
Microsoft are the leading consumer software company in the
world, arguably the leading software company full stop.
Yes, but this is because of their legal and marketing departments, not
because of programming and quality control.

Richard
Oct 9 '06 #49

Malcolm <re*******@btin ternet.comwrote in message
news:Zc******** ************@bt .com...
"Rod Pemberton" <do*********@bi tfoad.cmmwrote in message
"Keith Thompson" <ks***@mib.orgw rote in message
news:ln******** ****@nuthaus.mi b.org...
Frederick Gotham <fg*******@SPAM .comwrites:
[...]
They have enough money to stop focusing on business, and start
focusing
on
what they actually would like to do. Bill Gates gives millions (if
not
billions) to charity every year.

If they're greedy enough to write non-portable code for the sake of
non-
portable code, you'd wouldn't expect them to be giving money to
charity...
>
Bill Gates is not Microsoft. Bill Gates is an individual, who can do
whatever he likes with his own money.
True.
Microsoft is a business with a
fiduciary responsibility to its shareholders.
That's the theory, but it is not true in reality for any of the Fortune
500.
The reason is mutual funds. Ballmer is CEO. Gates is on the Board of
Directors. 14% of Microsoft stock is controlled by Gates and Ballmer.
(Interesting, Paul Allen isn't anywhere to be found in the ownership of
stock.) 67% of Microsoft is owned by Mutual funds. They own voting
stock.
Three years after SEC rules to force mutual funds to reveal proxy votes,
the
largest mutual funds vote in favor of management 95% of the time with
the
industry as a whole voting in favor of management 74% of the time. (I
would
assume 100% before July 2003 based on past Forbes articles...)
http://money.cnn.com/2006/03/28/news..._votes_ceopay/

NASDAQ's stock market (electronic transactions) caters to technology
firms
which don't usually pay dividends. Also, it doesn't allow the short
sales
of securities. On NYSE, a stock exchange, a stock's price can be driven
down by two forces: selling and shorting. It can be driven up (or held
up)
by two forces: buying and dividends. Short selling and dividends help
to
correct imbalances, usually short term, that aren't percieved or are
ignored
by certain investors, usually long term. Unfortunately, a problem
arises
when a NASDAQ security, like MSFT, begins paying a dividend. When the
buyers and sellers are roughly in balance, the dividend attracts more
buyers
which upholds a certain price, but there is no counterbalancin g force to
drive the price of the stock down if others recognize that it is
actually
underperforming (i.e., no short selling). This creates an upward price
distortion on NASDAQ for dividend paying securities. Of course, the
usual
method on NYSE to wrest corporate control from incompetent management is
to
drive the stock price down by selling and shorting until it is delisted.
Without short selling, it is harder to delist a dividend paying NASDAQ
security. This insulates underperforming management from change. Due
to
this, if MSFT was a NYSE security, it's value would be lower.

You could also study how Kerk Kerkorian, KKR, Leon Black, or Ronald
Perelman, etc. get control with small percentages of ownership.
How boring.
Not that it really matters here, but it wasn't just boring, it was also
insanely factually incorrect. I particularly enjoyed this ridiculous
statement:
NASDAQ's stock market (electronic transactions) caters to technology
firms
which don't usually pay dividends. Also, it doesn't allow the short
sales
of securities.
Take it from somebody who has shorted a LOT of NASDAQ stocks
over the last few years, NASDAQ definitely allows shorting.
To think that some people read this sort of stuff for a living.
That was just a typical whacko uninformed Usenet rant.
NOBODY reads that sort of stuff for a living. If I got paid
every time I read a Holocaust denial, an Illuminati conspiracy
theory, et. al., on Usenet, I'D be richer than Bill Gates...

---
William Ernest Reid

Oct 10 '06 #50

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1968
by: lawentzel | last post by:
I am new to PHP and am an avid RPG gamer. I am looking to use PhpMyChat to be able to game with friends all over the US. With that having been said, PhpMyChat seems to offer a lot of what I am looking for. It allows you to send a message to individual players (chatters). It allows for actions using "/me". The only thing it really needs is the capability to do a dice roll. Can someone point me to a site which might have some examples...
4
6388
by: dpp4669 | last post by:
I need help with writing a program to use randmax and the standard deviation when u roll the dice 10000 times I know you will need the standard dev. and the average where do i put the randmax and do i use 1+6 after it ? LOST!
17
9624
by: Jose Durazo | last post by:
Hello, I'm doing an exercise to simulate rolling a pair of dice 36,000 times, then count and display how many times the simulation rolls each possible sum. For some reason each time I run my simulation, one or more of my sums is zero, which is highly unlikely. So I'm sure there's a bug in my code. But I can't tell what it is, even after re-reading it several times. Can someone give me a hint? Here is my code:
4
4137
by: vegtard | last post by:
simple question. is it possible to write a script that rolls a six sided dice? if this is possible, is it possible to tell it to roll the six sided dice 4 times and ignore the dice that rolled the lowest score? if you want to know, i am working on a script to create a dungeons and dragons character :)
2
3403
by: sunnydude | last post by:
Anybody know how to write a 3 dice rolling program like this Sample output Welcome to the dice roller! First of all, please enter a seed for the random number generator. This should be a positive integer: 3 How many times would you like me to roll the 3 dice?
2
6492
by: cowboyjeff05 | last post by:
the question is 1) build a Die class (6 sided). Then create a driver that tests your class. Start with one die in your driver then add a second die and notify the user and count when he or she rolls 7, 11, or a double. When the user is done rolling, output the results of the session. Create a child class from the Die class called MultisidedDie. This die should allow the programmer using the class to decide how many sides the die has. ...
0
9980
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9829
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11236
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10926
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9643
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8018
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7172
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4683
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3287
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.