摘要: 看似简单的一个题目,相信大部分人都会第一时间说出rand()函数,但是我们的做法真的正确么?生成的随机数确实真的随机么?1. 看下面代码,用rand()生成随机数int main(){ cout<<"rand() traps by Sparkles."<<endl; int N = 10... 阅读全文
posted @ 2014-04-06 15:00 Sparkles 阅读(183) 评论(0) 推荐(0) 编辑
摘要: An adapter pattern converts the interface of a class into another interface the clients expect. Adapter lets classes work together that couldn't other... 阅读全文
posted @ 2013-07-01 18:20 Sparkles 阅读(201) 评论(0) 推荐(0) 编辑
摘要: Preamble: what is a reference type?In .NET (and therefore C#) there are two main sorts of type: reference types and value types. They act differently, and a lot of confusion about parameter passing is really down to people not properly understanding the difference between them. Here's a quick ex 阅读全文
posted @ 2013-06-28 18:11 Sparkles 阅读(291) 评论(0) 推荐(0) 编辑