Home > Web Front-end > JS Tutorial > body text

用js来生成随机彩票号码清单_javascript技巧

WBOY
Release: 2016-05-16 19:19:39
Original
1457 people have browsed it

朋友说他的朋友喊问的问题。彩票店,想打印一个清单出来。

有编号1-22的22个球,从里面随机拿5个出来。拿出来后不放回去。

例如我第一次拿出来是号码5,第二次就是从剩下的21个球里面拿。依此类推,一共拿5个球出来。

拿出来最后5个球,排列的顺序不管,就是说拿出来是1 2 3 4 5和 5 4 3 2 1 的这样算是一样的号码,打印出来清单只能出来一次

最后把所有的结果打印出来。他所谓的简单的排列组合的问题,涉及到数组的一些操作,我暂时脑子昏没法思考。

看有没有大大可以解答了,提供一些比较方便的算法,非常感谢


[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]


[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!