宝哥软件园

JS简单随机数生成方法

编辑:宝哥软件园 来源:互联网 时间:2021-09-07

本文阐述了JS简单随机数的生成方法。分享给大家参考,如下:

!doctype html townleta charset=' utf-8 ' titlerandom number/title/head dyscript type=' text/JAVAScript '函数randnum(value){ var s=1000;var d=500if(value==' b '){ document . write(s parsent(500 * math . random()));} else { document . write(d parsent(500 * math . random()));} }/scriptscriptRandnum();/脚本/正文/html渲染:

更多对JavaScript算法感兴趣的读者可以查看本网站的主题:《JavaScript数学运算用法总结》、《JavaScript排序算法总结》、《JavaScript遍历算法与技巧总结》和《JavaScript数据结构与算法技巧总结》

希望本文对JavaScript编程有所帮助。

更多资讯
游戏推荐
更多+