CS253 IQ 15
Show Main.IQ15 as a slide show.
set<int>
default second template argument
operator<
less
less<int>
less<int>()
- There isn’t one.
C: it must be a type, a comparison functor, not an object.
bind
What’s the easiest way to create a variable pointing to the
function beta
, which calls the two-argument function alpha
,
but with the arguments swapped?
bind(beta, alpha, 2, 1);
auto beta = bind(alpha, 2, 1);
auto beta = bind(alpha, _2, _1);
- A lambda function would be shorter.
int beta(int a, int b) { return alpha(b,a); }
What is the period of minstd_rand
?
- 232
- 232−1
- 231
- 231−1
- 231−2
- I don’t know what “period” means. ☹
The word “period” means how many values it returns before it repeats.
E: x = x * 48271 % 2147483647 // always positive, never zero
Random Numbers
mt19937
is deterministic—given the same seed, it will
produce the same sequence of numbers each time.
- yes
- no
- depends on the implementation
mt19937
is not a generator.
A: All generators are deterministic, perhaps except for random_device
.
Where is the final exam?
- here
- someplace else
Here! This very room!
When is the final exam?
- Thursday December 19 6:20ᴀᴍ
- Thursday December 19 6:20ᴘᴀ
- Thursday December 19 6:20ᴍᴘ
- Thursday December 19 6:20ᴘᴍ
- Thursday December 19 6:20ᴍᴀ
- Thursday December 19 6:20ᴀᴘ
Thursday December 19 6:20ᴘᴍ