javascript,每天增加数量 [英] javascript, increase number day by day

查看:123
本文介绍了javascript,每天增加数量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要用javascript编写代码,以增加给定的数字并将其加起来 随机范围数字,最后显示出来. 必须保存该值,因为第二天应该使用相同的具有随机数范围的和"来增加当前结果.

例如:

给定编号:135

随机范围:5到20

所以:

当前日期= 135 +随机范围,然后将其保留接下来的24小时.

第二天=当前日期+随机范围,然后将其保留接下来的24小时....

但我不知道该怎么做,请你帮帮我吗? 我真的很感激.

I need to write a code with javascript which increase the given number and sum it with a random range numbers and finally displays it. This has to be saved, because the next day, this should increment current result, using the same "sum with random range of numbers".

for instance:

Given number: 135

Random range: 5 to 20

So:

Current day=135+random range, then keep it for next 24 hours.

Next day=Current day+random range, then keep it for next 24 hours....

but I don't know how to do it, would you please help me? I really appreciate it.

推荐答案

此外,您可以使用自己的简单伪随机数生成器,该生成器将根据初始数字(可能存储在cookie中)和当前日期.因为cookie的大小非常严格,所以可以节省空间.

Also, you could use your own simple pseudo-random generator, which would calculate current day value depending on the initial numbers (maybe stored in cookies) and a current date. It could save space, because cookies are very strict in size.

这篇关于javascript,每天增加数量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆