﻿<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="https://www.yfrobot.com.cn/wiki/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh">
		<id>https://www.yfrobot.com.cn/wiki/index.php?action=history&amp;feed=atom&amp;title=Cores%3AWMath.cpp</id>
		<title>Cores:WMath.cpp - 版本历史</title>
		<link rel="self" type="application/atom+xml" href="https://www.yfrobot.com.cn/wiki/index.php?action=history&amp;feed=atom&amp;title=Cores%3AWMath.cpp"/>
		<link rel="alternate" type="text/html" href="https://www.yfrobot.com.cn/wiki/index.php?title=Cores:WMath.cpp&amp;action=history"/>
		<updated>2026-04-08T09:27:38Z</updated>
		<subtitle>本wiki的该页面的版本历史</subtitle>
		<generator>MediaWiki 1.22.6</generator>

	<entry>
		<id>https://www.yfrobot.com.cn/wiki/index.php?title=Cores:WMath.cpp&amp;diff=344&amp;oldid=prev</id>
		<title>Admin：以“&lt;font color=&quot;quartz&quot; size =&quot;+2&quot;&gt; '''WMath.cpp ''' &lt;/font&gt;  &lt;pre style=&quot;color:royalblue&quot;&gt; /* -*- mode: jde; c-basic-offset: 2; indent-tabs-mode: nil -*- */  /*   Part...”为内容创建页面</title>
		<link rel="alternate" type="text/html" href="https://www.yfrobot.com.cn/wiki/index.php?title=Cores:WMath.cpp&amp;diff=344&amp;oldid=prev"/>
				<updated>2015-07-10T11:42:45Z</updated>
		
		<summary type="html">&lt;p&gt;以“&amp;lt;font color=&amp;quot;quartz&amp;quot; size =&amp;quot;+2&amp;quot;&amp;gt; &amp;#039;&amp;#039;&amp;#039;WMath.cpp &amp;#039;&amp;#039;&amp;#039; &amp;lt;/font&amp;gt;  &amp;lt;pre style=&amp;quot;color:royalblue&amp;quot;&amp;gt; ‎&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;-*- mode: jde; c-basic-offset: 2; indent-tabs-mode: nil -*-：&lt;/span&gt;  /*   Part...”为内容创建页面&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新页面&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;font color=&amp;quot;quartz&amp;quot; size =&amp;quot;+2&amp;quot;&amp;gt; '''WMath.cpp ''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color:royalblue&amp;quot;&amp;gt;&lt;br /&gt;
/* -*- mode: jde; c-basic-offset: 2; indent-tabs-mode: nil -*- */&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
  Part of the Wiring project - http://wiring.org.co&lt;br /&gt;
  Copyright (c) 2004-06 Hernando Barragan&lt;br /&gt;
  Modified 13 August 2006, David A. Mellis for Arduino - http://www.arduino.cc/&lt;br /&gt;
  &lt;br /&gt;
  This library is free software; you can redistribute it and/or&lt;br /&gt;
  modify it under the terms of the GNU Lesser General Public&lt;br /&gt;
  License as published by the Free Software Foundation; either&lt;br /&gt;
  version 2.1 of the License, or (at your option) any later version.&lt;br /&gt;
&lt;br /&gt;
  This library is distributed in the hope that it will be useful,&lt;br /&gt;
  but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU&lt;br /&gt;
  Lesser General Public License for more details.&lt;br /&gt;
&lt;br /&gt;
  You should have received a copy of the GNU Lesser General&lt;br /&gt;
  Public License along with this library; if not, write to the&lt;br /&gt;
  Free Software Foundation, Inc., 59 Temple Place, Suite 330,&lt;br /&gt;
  Boston, MA  02111-1307  USA&lt;br /&gt;
  &lt;br /&gt;
  $Id$&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
extern &amp;quot;C&amp;quot; {&lt;br /&gt;
  #include &amp;quot;stdlib.h&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void randomSeed(unsigned int seed)&lt;br /&gt;
{&lt;br /&gt;
  if (seed != 0) {&lt;br /&gt;
    srandom(seed);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
long random(long howbig)&lt;br /&gt;
{&lt;br /&gt;
  if (howbig == 0) {&lt;br /&gt;
    return 0;&lt;br /&gt;
  }&lt;br /&gt;
  return random() % howbig;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
long random(long howsmall, long howbig)&lt;br /&gt;
{&lt;br /&gt;
  if (howsmall &amp;gt;= howbig) {&lt;br /&gt;
    return howsmall;&lt;br /&gt;
  }&lt;br /&gt;
  long diff = howbig - howsmall;&lt;br /&gt;
  return random(diff) + howsmall;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
long map(long x, long in_min, long in_max, long out_min, long out_max)&lt;br /&gt;
{&lt;br /&gt;
  return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
unsigned int makeWord(unsigned int w) { return w; }&lt;br /&gt;
unsigned int makeWord(unsigned char h, unsigned char l) { return (h &amp;lt;&amp;lt; 8) | l; }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Arduino核心代码|返回核心代码首页]]&lt;br /&gt;
&lt;br /&gt;
更多建议和问题欢迎反馈至 [http://www.yfrobot.com YFRobot论坛]&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>