On Monday, 25 July 2022 at 21:43:37 UTC, Salih Dincer wrote:
On Monday, 25 July 2022 at 04:23:16 UTC, test123 wrote:
not match by:
1) the element is not repeat
2) the element is position related
I got it now. So what good are such repetitive probabilities?
Thanks...
SDB@79
just try a stu
On Monday, 25 July 2022 at 04:23:16 UTC, test123 wrote:
not match by:
1) the element is not repeat
2) the element is position related
I got it now. So what good are such repetitive probabilities?
Thanks...
SDB@79
On Sunday, 24 July 2022 at 15:49:51 UTC, Salih Dincer wrote:
On Sunday, 24 July 2022 at 15:11:45 UTC, Salih Dincer wrote:
...But you know this classic recurisive function:
The `permut()` function works with many types, for example
`char`. Look at probability 40: 😀
```d
void main() {
int t
On Sunday, 24 July 2022 at 15:11:45 UTC, Salih Dincer wrote:
...But you know this classic recurisive function:
The `permut()` function works with many types, for example
`char`. Look at probability 40: 😀
```d
void main() {
int totalCount;
['a', 'd', 'g', 'l', 'n'].permut(totalCount);
t
On Sunday, 24 July 2022 at 08:16:41 UTC, Test123 wrote:
On Saturday, 23 July 2022 at 23:14:03 UTC, Salih Dincer wrote:
On Saturday, 23 July 2022 at 22:50:55 UTC, Salih Dincer wrote:
[...]
I guess my code didn't list all possibilities either.
Moreover, the m and n parameters will be swapped:
On Saturday, 23 July 2022 at 23:14:03 UTC, Salih Dincer wrote:
On Saturday, 23 July 2022 at 22:50:55 UTC, Salih Dincer wrote:
[...]
I guess my code didn't list all possibilities either. Moreover,
the m and n parameters will be swapped:
[...]
**PS.** * marked from version(c) in the above
On Saturday, 23 July 2022 at 22:50:55 UTC, Salih Dincer wrote:
**My code outputs:**
```
[0, 0, 0, 0, 0, 0, 0, 0]: 1
[0, 0, 0, 0, 0, 0, 0, 1]: 2
[0, 0, 0, 0, 0, 0, 1, 0]: 3
[0, 0, 0, 0, 0, 0, 2, 1]: 4
[0, 0, 0, 0, 0, 1, 1, 0]: 5
[0, 0, 0, 0, 0, 2, 0, 1]: 6
[0, 0, 0, 0, 0, 2, 1, 0]: 7
[0, 0, 0, 0,
On Saturday, 23 July 2022 at 19:50:51 UTC, Test123 wrote:
I has this function, it print all possible combinations.
```d
void doRepetition(const int n, const int m){
// combination total number is m, element is repeatable.
// ...
}
```
`doRepetition(4, 3);` will print
0 0
0 1
0 2
1 1
1
On Saturday, 23 July 2022 at 20:00:06 UTC, rikki cattermole wrote:
A bit more d-ified and uses foreach + foreach_reverse without
allocating an array.
[...]
Your give the correct code, but wrong Output.
Thanks again for the help.
On Saturday, 23 July 2022 at 20:00:06 UTC, rikki cattermole wrote:
A bit more d-ified and uses foreach + foreach_reverse without
allocating an array.
[...]
Thanks for the quick reply.
I also get your results, it is not correct because the secends
number is not matched.
Not I look at you
A bit more d-ified and uses foreach + foreach_reverse without allocating
an array.
```d
import std.stdio;
void main()
{
doRepetition(4, 3);
writeln("==");
doRepetitionReversed(4, 3);
}
void doRepetition(const int n, const int m)
{
// combination total number is m, elem
On Saturday, 23 July 2022 at 19:50:51 UTC, Test123 wrote:
I has this function, it print all possible combinations.
```d
void doRepetition(const int n, const int m){
// combination total number is m, element is repeatable.
assert(n >= 1 && n < 10);
assert(m >= 1 && m < 10);
enum
12 matches
Mail list logo