以添加颜色为例,new 一个swift文件夹 不是cocoa类 也不需要继承什么。然后 1 import UIKit 2 3 protocol ColorDalegate{ 4 class func mainColor(Void) -> UIColor 5 } 6 7 extension...
分类:
编程语言 时间:
2014-10-16 18:27:12
阅读次数:
226
一、为什么需要服从正态分布的随机函数一般我们经常使用的随机数函数 Math.random() 产生的是服从均匀分布的随机数,能够模拟等概率出现的情况,例如 扔一个骰子,1到6点的概率应该相等,但现实生活中更多的随机现象是符合正态分布的,例如20岁成年人的体重分布等。假如我们在制作一个游戏,要随机设定...
分类:
编程语言 时间:
2014-10-16 17:53:52
阅读次数:
404
ios7以下的版本设置导航栏背景颜色可以使用
[[UINavigationBar appearance] setTintColor:[UIColor orangeColor]];
ios7以后:
[[UINavigationBar appearance] setBarTintColor:[UIColor orangeColor]];
默认带有一定透明效果,可以使用以下方法去...
分类:
移动开发 时间:
2014-10-16 15:46:25
阅读次数:
176
random函数不是ANSI C标准,不能在gcc,vc等编译器下编译通过。但在C语言中int random(num)能够这样使用,它返回的是0至num-1的一个随机数。可改用C++下的rand函数来实现。rand()%n 范围 0~n-1rand()主要是实现 产生随机数,其它我们在这里能够无视他...
分类:
其他好文 时间:
2014-10-16 15:46:22
阅读次数:
160
1.自定义函数function getRandom(min,max){ //x上限,y下限 var x = max; var y = min; if(x<y){ x=min; y=max; } var rand = parseInt(Math.random() * (x - y + 1) + y);...
分类:
Web程序 时间:
2014-10-16 14:25:22
阅读次数:
1867
游戏中创建角色有个随机取名功能,用到了随机数,网上找了篇在lua中使用随机数的文章,mark一下。Lua 生成随机数需要用到两个函数:math.randomseed(xx), math.random([n [, m]])1. math.randomseed(n) 接收一个整数 n 作为随机序列种子。...
分类:
其他好文 时间:
2014-10-15 19:57:31
阅读次数:
189
// 设置状态栏颜色 [application setStatusBarStyle:UIStatusBarStyleLightContent]; // 设置导航栏 [[UINavigationBar appearance] setTintColor:[UIColor whi...
分类:
其他好文 时间:
2014-10-15 19:15:11
阅读次数:
645
问题: A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null. Return a deep ...
分类:
其他好文 时间:
2014-10-15 15:40:50
阅读次数:
262
在Java中我们能够使用java.util.Random类来产生一个随机数发生器。它有两种形式的构造函数,各自是Random()和Random(long seed)。Random...
分类:
编程语言 时间:
2014-10-15 14:06:09
阅读次数:
228
#Listimportshere:importturtleimportrandomimportmath#Listconstantshere(NOMAGICNUMBERS!):NUMBER_DARTS=1000LEFT_BOUND=-2RIGHT_BOUND=2TOP_BOUND=-2BOTTOM_B...
分类:
编程语言 时间:
2014-10-15 12:35:40
阅读次数:
636